Home>Article>Backend Development> pycharm How to put multiple apps in Django into the same folder apps

pycharm How to put multiple apps in Django into the same folder apps

不言
不言 Original
2018-06-01 14:49:28 2461browse

This article mainly introduces how pycharm puts multiple apps in Django into the same folder apps. It has a certain reference value. Now I share it with you. Friends in need can refer to it

If you need to create multiple apps in django, you need to create an apps file and put all the apps in the same folder. This is clearer and looks more standardized.

First of all, Right-click the project file--new-python package to create an apps file, drag all apps into apps,

will pop up a dialog box and select search for references and Uncheck open moved files in editor, click Confirm. At this time, click run, and a running error will appear

in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

At this time, you need to right the apps folder Click – select mark directory as – select sources root, then click run, and it will run normally

At this time, it can basically be used normally in pycharm, but if deployed This cannot be the case in the actual environment. You need to add

sys.path.insert(0,os.path.join(BASE_DIR,'apps'))

to the setting.py file so that it can be used normally in actual deployment.

The above is the detailed content of pycharm How to put multiple apps in Django into the same folder apps. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn