How to import an existing django project in pycharm

I have the following directory tree

myproject β”œβ”€β”€ data β”œβ”€β”€ libs └── wsgi β”œβ”€β”€ openshift └── static 

openshift contains a settings file and a manage.py file. I want the user to control .py through pycharm, but it will not work, neither the runerver command, nor startapp nor anything that needs to be done.

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 runningerver 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 turned on django support and installed wsig as a django root project. Running manage.py from the terminal works fine.

what am I doing wrong?

EDIT: the manage.py shell starts from pycharm EDIT2: I managed to get it to work by following the openshift structure and creating the openshift django project root folder and some import changes. Now everything works fine

+6
source share
3 answers

Open myproject as your project, and then go to PyCharm -> Preferences ... -> Django, enable Django support, and then select your Django project root, the settings file, and execute the script control.

+10
source

just open pycharm and select the open option from the file menu. Then select your catalog and do ..!

If you are having problems using the command line, try creating a new project from pycharm itself.

+2
source

I usually modify the startup configuration working directory setting.

You can enter your directory working path in this field, then python will find the project parameters module

0
source

Source: https://habr.com/ru/post/976291/


All Articles