how to import an existing django project to pycharm

24,381

Solution 1

Open myproject as your project and then go to PyCharm -> Preferences... -> Django, Enable Django Support and then choose your Django project root, settings file and manage script.

Solution 2

just open pycharm and in file menu select open option. Then choose your directory and done..!

If you have problem with using command line then you should try building a new project from pycharm itself.

Share:
24,381
Apostolos
Author by

Apostolos

Updated on July 09, 2022

Comments

  • Apostolos
    Apostolos almost 2 years

    I have the following directory tree

    myproject
    ├── data
    ├── libs
    └── wsgi
        ├── openshift
        └── static
    

    openshift contains the settings file and the manage.py file. I want to user manage.py through pycharm but it won't work, nor the runserver command nor the startapp neither anything to be precice.

    running startapp gives me the following errors

    bash -cl "/usr/bin/python2.7 manage.py startapp quiz"
    /usr/bin/python2.7: can't open file 'manage.py': [Errno 2] No such file or directory
    
    Process finished with exit code 2
    

    running runserver it gives me the following

    ImportError: Could not import settings 'openshift.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named openshift.settings
    
    Process finished with exit code 1
    

    I have enabled django support and set wsig as django root project. Running manage.py from terminal works fine.

    what am i doing wrong?

    EDIT: running manage.py shell from pycharm also works EDIT2: I managed to get it working by following openshift's structure and making openshift the django project root folder, and some edits to the imports. Now everything works great

  • Apostolos
    Apostolos over 9 years
    You have to enable django support and not only open the directory within pycharm. I know I can build it from scratch using pycharm but I don't. I get my folder from openshift git repo.
  • Jay Modi
    Jay Modi over 9 years
    okay understand and i think you need more expert answer. sorry. tried to help.
  • Aidas Bendoraitis
    Aidas Bendoraitis over 9 years
    Do you have a virtual environment for your project? Is Django installed?
  • Apostolos
    Apostolos over 9 years
    No to virtual enviornment and yes to Django install