Renaming and removing PyCharm projects

Answered

How should I rename a PyCharm project?

Delete a PyCharm project?

18 comments

Hello Nate,

A PyCharm project is simply a directory. You can rename or delete it from

any file manager.

How should I rename a PyCharm project?

Delete a PyCharm project?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0

There is another name that shows up though, i.e. I first opened pycharm on the "beta12" branch of my project, I checked in the .idea directory, and then the phrase "beta12" continued to ever after show up in the title bar, even in other branches, in other checkouts, in directories with different names.

I haven't found anywhere in the UI to correct that.

0

Dmitry,

I didn't know how to open the project in PyCharm if I simply rename the directory.

I found that File->Open Directory will re-open the project.

Thanks,

Nate

-1

This doesn't work for Django projects, though.

After renaming my Django project and reopening it as a directory, I am unable to run the webserver.  This is the error I get:

/usr/bin/python2.6 /home/nate/PycharmProjects/DjangoAuctions/auctions/models.py
Traceback (most recent call last):
  File "/home/nate/PycharmProjects/DjangoAuctions/auctions/models.py", line 1, in <module>
    from django.contrib.auth.models import User
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/models.py", line 6, in <module>
    from django.db import models
  File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py", line 14, in <module>
    if not settings.DATABASES:
  File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 276, in __getattr__
    self._setup()
  File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 38, in _setup
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

Process finished with exit code 1

Nate

0

In the .idea dir under your project dir, find the iml file and rename it.

3
Just renaming the folder and the .iml file still left the old project name in the title bar of PyCharm.  The following fixed all for me:  First close the project, then change the name of the folder containing the project.  Next, go into the project folder and open the .idea folder, change the filename of the .iml file, then open the .name file and edit the first line in there, and save.  Now open the directory, and all should be well.
4

User should not have to do this; this should be in the GUI. Simple use case: I want to have a clone of my project, but rolled back to an earlier revision of repository. Right now after I copy the folder, I have to go through this riggemorole to rename the clone. 

0

It is actually a lot simpler in the last version (5.0.5). Simply do the following:

  1. Right click the root folder in project toolbar
  2. Select in context menu "Refactor"->"Rename"
  3. Choose "Rename Project"
8

I am not sure this is the exact need you have, but here is my experience.

We have repos with a proper name, but normally at 0 level there is a lot of boilerplate and in source folder we keep our code. We use this convention across languages, so IDEA, PyCharm, WebStorm and anything else knows where to find what and what to run based on naming conventions.

Said this, we obviously prefer the folder source for our code, so we get exactly what we need for development, however in recent projects we see everything called source.

In order to properly name them with the repo name, we have to create the .name file with it, as suggested above.

What is very annoying is that there is no way to change it from IDE.

0

Thanks for posting that Vitaly. However, renaming a project is not something anyone would think of as refactoring IMO, so this submenu item is not where such functionality should be located.

0

@Vitaly Belman - Thanks, that's it. :D In addition to that, directory should be renamed manually, since it is not automatically renamed.

0

you just need to delete the .idea file for the project and this should fix the problem of having the renaming mapping when you change the project name

0

I'm using PyCharm CE 2017.2.2, and I had a couple of projects I needed to delete.  The following steps worked:

1)  Exit PyCharm.  If you don't, it's likely to recreate an essentially empty version of any deleted projects when you exit later.

2)  Using your O/S file manager, delete the root folder for each PyCharm project you want removed, which will delete the entire project tree, including any .idea folders.

3)  Start PyCharm.  The deleted projects will still be on the welcome page.

4)  On the PyCharm welcome page, right click on each project you deleted and choose the option to remove it from the welcome page.

At that point, all record of your deleted projects will be gone from your system and PyCharm.

0

Best, easiest solution for my purpose (starting a new project based on an old one in order to save re-writing a s***load of code / copy paste, etc.)
Indeed, I could think of a better place for the sub menu and, therefore, thanks again for this hint... 

Maybe PyCharm programmers will move it in the next version to a more appropriate place

0

I'm new to both Python and PyCharm. I've been doing a lot of experimenting, both with code and versions of Python (32 vs 64 bit) 3.6.5 and Python 2.7. Finally read somewhere that the 32 bit version is more stable. I have a Windows 10 System and my MS access Driver is 32 bit so I am going with the 32 bit version of 3.6.5. The problem I have is I installed and then uninstalled several versions of Python and did a Windows explorer search for Python.exe and there are a whole bunch of them. What would be helpful is something like a Clean-up utility that would check out your systems current state and then list your projects and then give you the option of deleting old ones and then checking that all the file associations are correct for the current project(s). Not sure how practical or doable it is but I think I've made a mess of my hard drive and not sure the best way of cleaning it up is aside from going through and deleting those project root directories as suggested by Tywait above. Anyway open to suggestions. Thanks

0

Hi Joseph, not sure how python.exe is related to PyCharm projects, did you create a per-project venv for each of them? Where are the projects located? There's no such utility to scan your drives for PyCharm projects, but it should easy to write one, just search for all folders with .idea in it and do whatever you want with them.

1

Pavel,

First, Thank you for responding to my post. To be honest I'm not sure what all I did, but I think your suggestion will help a lot. The projects are located way down in the users path but upon further investigation they look to be in the Pycharm Project sub-directory. 

Will look at it again as time permits. Everything is functional though so I'm the hold up not my machine.

Thank you again!!!

0
they look to be in the Pycharm Project sub-directory

By default PyCharm uses PycharmProjects folder in your user home to store new projects. If you didn't change the path then all the projects should be there.

0

Please sign in to leave a comment.