django - 是否有使用 cookiecutter-django 创建应用程序的命令?

标签 django cookiecutter-django

使用 cookiecutter-django 创建 Django 项目后,是否有像 python manage.py startapp <app_name> 这样的命令运行而不是从头开始编写新应用程序?

最佳答案

为了完整起见,我想补充一点,特定于项目的应用程序应该进入第二级,在使用 Cookiecutter Django 时也是如此。

有一个GitHub issue about this ,项目维护者explains the situation .

您应该执行以下操作:

1 - create the <name-of-the-app> app with python manage.py startapp
2 - move <name-of-the-app> directory to <project_slug> directory
3 - edit <project_slug>/<name-of-the-app>/apps.py and change name = "<name-of-the-app>" to name = "<project_slug>.<name-of-the-app>"
4 - add "<project_slug>.<name-of-the-app>.apps.<NameOfTheAppConfigClass>" to LOCAL_APPS in config/settings/base.py

关于django - 是否有使用 cookiecutter-django 创建应用程序的命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39838290/

相关文章:

django - 备份 Django 项目的最佳方法是什么?

Python TastyPie - 自定义管理器方法作为过滤器?

python - 如何使用 django.test.Client 设置 multipart/form-data 部分的标题?

python - 将 cookiecutter-django 和 gunicorn 部署到 digital ocean 的 Production.py 问题

python - 外壳错误 : doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

python - 初始设置后 Dajaxice 函数不可调用错误

python - Django CharField主键不起作用,自动创建rowid主键

django - Digital Ocean docker 镜像的主管

django - 错误 : Pidfile (celerybeat. pid) 已存在

django - 如何将django-cookiecutter制作的多个Docker镜像推送到Heroku?