How To Import Existing Django Project And Enable Django Support In PyCharm

I have two machine for example development, one is MacOS the other is a Linux Ubuntu. I create a Django project in MacOS machine but now i need to develop this Django project in Linux Ubuntu, so i need to import the project in Ubuntu to edit and run, this article will tell you how to do it in Ubuntu correctly.

1. Import Existing Django Project.

The source code is maintained on github, and i use smartgit to control the source code versions. Please refer article How To Use SmartGit In Ubuntu to learn more. Then you can use smartgit to clone the Django project source code to your local machine. Next you can import the project in PyCharm follow below steps.

  1. Start PyCharm and click File —> Open menu item to open the Django project selection window.
  2. Select the Django project saved folder, then click OK button.
  3. Now the existing Django project has been opened in PyCharm correctly.

2. Enable Django Support For Existing PyCharm Project.

After you edit source code then you need to run the Django project with follow steps.

  1. Select the existing Django project in PyCharm in left panel.
  2. Click Run —> Run menu item in the top tool bar.
  3. Then click Edit Configurations… menu item in the popup menu list.
    select pycharm run target project
  4. Run configuration window will popup and there is an error message in the bottom left, the error message is Error: Please enable Django support for the project.
    configuration settings for run django project in pycharm
  5. Just click the Fix button at bottom right then it will popup another Settings window like below.
    pycharm enable django support for special django project
  6. Check the Enable Django Support checkbox, then select the Django project root folder, the project settings.py file and the project manage.py file. Then click Apply and OK button, then you can run your Django project with the specified configurations. Now you have successfully import the existing Django project to the PyCharm installed on Ubuntu OS.
READ :   Django Unit Test Example

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.