How to import a non PyCharm directory to PyCharm as a PyCharm project?

I am new to using PyCharm and it is by far the best python/django IDE I found up to date.

Question 1:

I have django projects from other IDEs that I want to import into PyCharm as a PyCharm project so my whole collection can be within the PycharmProjects directory.

Lets say my old projects are currently residing in the workspace folder that Eclipse stores projects in. How would I import them from here to PyCharm? I could simply drag and drop the django project folders to my PycharmProjects folder but when I load PyCharm they are not shown as actual PyCharm projects like the ones you create through PyCharm.

Question 2:

I am using Windows. A couple of django tutorials that I have been following start out with me creating a django project, then creating some apps within it etc.. But then further throughout the book they tell me that the best way to create applications is to not create them with manage.py startapp (within a project). They say it is to start a custom application that isn't within a project by making an empty folder (APPNAME) within an applications directory. Then create 4 blank files (__init__.py, models.py, admin.py, views.py). The book says that when you make apps this way they are very easy to integrate with multiple/different projects. Ok so as I continued with the tutorial I went to run the command python manage.py syncdb and it doesn't work. I think this is because my "applications" directory is not within the PYTHONPATH. With windows what kind of environment variable would I add to make this work. So far all I added was C:/Python27;C:\Python27\Scripts

I also don't understand how my applications from projects in the PyCharmProjects folder are automatically within the PYTHONPATH. Is it because when they are created using startapp they are automatically configured since they are within a project.

How would I achieve this is I have an outside folder called "applications"  C:/user/james/applications where I want to store standalone apps.

If anyone has a better way of doing things please let me know. Any advice is appreciated for any of the questions I asked.

2 comments

To open an existing project in PyCharm, regardless of its actual location on disk, you use "Open Directory" and point to the directory where your project is located. If you want your project to be located under the PycharmProjects directory and not under the Eclipse workspace directory, simply move your project directory there using Explorer and then use "Open Directory" to open it.

When you run your project from PyCharm, it adds to PYTHONPATH the root directories of your project and all directories which are marked as source roots under Settings | Project Structure. Things should work if you simply add C:/user/james/applications as a content root to your project under Settings | Project Structure.

0

Thank you, this was answered perfectly!

0

Please sign in to leave a comment.