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

I have two machines for Django example development, one is a macOS the other is a Linux Ubuntu. I create a Django project in the 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.

Table of Contents

1. Import Existing Django Project.

The source code is maintained on GitHub, and I use a tool that name is 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 the 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 the 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 the source code then you need to run the Django project with the following steps.

  1. Select the existing Django project in PyCharm left panel.
  2. Click Run —> Run menu item in the top toolbar.
  3. Then click Edit Configurations… menu item in the popup menu list.
  4. The Run configuration window will pop up and there is an error message in the bottom left like below picture, 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 the bottom right then it will pop up 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 in the Django project root: section, select the project settings.py file in the Settings: section, and select the project manage.py file in the Manage script: section.
  7. Then click Apply and OK button, then you can run your Django project with the specified configurations. Now you have successfully imported the existing Django project to the PyCharm installed on Ubuntu OS.

Leave a Comment

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.