Reputation: 5588
What do I need to do in order to rename my Django project in PyCharm? I am new to Django and PyCharm and would like to use a different name for my project.
Upvotes: 34
Views: 16922
Reputation: 5588
I'm using Windows, but it's probably the same for other operating systems.
.idea
directory (in the project folder), rename the .iml
file..idea
directory, open the .name
file in a text editor and change the name in there.settings.py
file, you'll need to update the path specified in TEMPLATE_DIRS
.You may also want to update your Run/Debug configurations (Alt+Shift+F10).
You'll need to replace some other occurrences of your old project name. In PyCharm, Ctrl+Shift+F will allow you to search the contents of all your files to find these occurrences.
Upvotes: 12
Reputation: 3430
Maybe: right-click on root folder in "Project" window, choose Refactoring -> Rename and choose "Rename Project"
Upvotes: 10
Reputation: 8195
svass's answer worked for me, except that I also had to manually change instances of my old project name in files located inside the .idea directory of my project.
If you cd into your project directory and grep for your old project name
grep -rli oldprojectname ./.idea
That returned the following list for me, then I manually modified each file.
./.idea/modules.xml
./.idea/workspace.xml
./.idea/dataSources.xml
./.idea/oldprojectname.iml <-- this will need to be renamed to new project name, and it's contents modified
./.idea/dataSources.ids
./.idea/.name
./.idea/misc.xml
Upvotes: 3
Reputation: 596
The built-in solution for re-naming Django projects in PyCharm has worked for me in the past on small projects, although I haven't tried it on a large project yet. To use it, select the project folder from the file-tree (by default on the left hand side of the screen), then press shift-F6 to bring up the rename dialogue. You can enter in your new name here and preview the changes, which can help prevent surprises. If you're happy with the preview, click on the "Do Refactor" button at the bottom of the window.
This is also a useful way to rename Django apps.
You can access the same functionality through right-clicking on the folder/item and hovering over the Refactor sub-menu. Or pressing ctrl+shift+a and searching for rename
.
Upvotes: 48