简体   繁体   中英

how to import an existing django project to pycharm

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

打开myproject作为你的项目,然后转到PyCharm - > Preferences ... - > Django,启用Django支持,然后选择你的Django项目根目录,设置文件和管理脚本。

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.

I usually change the run configuration's working directory option.

You could type your working directory path into that field, then python will find the project's settings module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM