问题标签 [manage.py]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
django - 运行时出错 ./manage.py 验证
当我运行命令时
我得到错误
我通过 pip 在我的虚拟环境中安装了调试器。
django - 无法启动 Django 1.7.1 开发服务器
我将我的 Django 应用程序从 1.4.3 迁移到 1.7.1 我让它工作了一会儿,但现在每次我尝试运行开发服务器时它都会卡在:
本地主机不工作,也尝试使用其他 IP/端口 = 相同的结果。
我可以通过添加到设置文件来摆脱这个警告TEST_RUNNER = 'django.test.runner.DiscoverRunner'
,但开发服务器仍然没有运行
django - Django 强制 makemigrations 使用制表符而不是空格
当我运行 python manage.py makemigrations myapp 时,它会生成一个使用 4 个空格缩进的迁移文件 0001_initial.py。
我想要标签。有什么办法可以设置吗?(请不要对 4 个空格和制表符发表意见。)
python - 无法运行“python manage.py runserver”
这是一个由其他人编写的项目,我正在努力为该项目添加新功能。我是 python 和 django 的新手,所以以前的开发人员帮助我设置了环境。过去它运行良好,但今天当我尝试运行服务器时,它给了我错误:
这很奇怪,因为之前的开发人员确实在我的 labtop 上安装了 django(否则我之前如何成功运行服务器)。但我还是跑
再次安装django。然后它成功下载并安装了django。然后我尝试再次运行服务器,然后它给了我这个错误:
我无法弄清楚这一点,非常感谢任何帮助。我能想到导致这个问题的唯一原因可能是我为我的另一个项目安装了 anaconda。但这只是一种可能性,我不确定它是否有任何影响。
python - Ignoring existing table when ./manage.py migrate
I have a question about Django's migration feature when there is an existing table.
When I try to do "./manage.py migrate" so it can create the 5 tables above from models.py, I got an error message because there is an existing table, TB_TEAM_INF.
Since TB_TEAM_INF is a table being used by another team, I cannot remove the table. I cannot use a separated database either due to constraints of the project. In this case I open the migration file like 0001_initial.py and manually remove the model object, TB_TEAM_INF temporarily during migration.
Is there a better way to ignore existing tables when "./manage.py migrate" rather than manually editing the migration file?
I tried --exclude=TB_TEAM_INF or --ignore=TB_TEAM_INF option with ./manage.py migrate but it seems those options are not accepted. I am using Django 1.7.2.
python - Django manage.py sqclear 所有应用程序
我想在 Django 中获取所有应用程序的 sql 清晰代码。我可以使用./manage.py sqlclear
,但我需要指定一个应用程序名称,因此仅适用于一个应用程序。
有没有办法或命令来执行sqlclear
所有已安装的应用程序?
python - 如果多个 Django 应用定义了相同的自定义管理命令,使用哪个?
文档对此问题保持沉默。命令是否会按顺序注册,以后的应用程序(按settings.INSTALLED_APPS
顺序)会覆盖以前的命令(无论是来自其他应用程序的自定义命令还是内置的 Django 命令)?
django - Django - ./manage.py 默认为 python 2.x
所以我已经:chmod +x manage.py
所以我可以./manage.py
在需要的时候使用,但它默认为 python 2.7,但我希望它使用我也安装的 python 3.4。我知道我可以使用python3 manage.py
,但我想知道是否有一种方法可以在不调用默认 python 的情况下使用快捷方式。
我在 Ubuntu 上,而不是在虚拟环境中,并且不想将 py3 设为默认值,因为我知道系统中的某些核心操作需要 py2,所以我很感激本地化的解决方案。
谢谢!
编辑:在这个问题之后的几天,由于系统的默认 python 2 和 python 3 搞乱了,我开始在系统级别遇到问题,并通过使用 virtualenv 解决了冲突问题。因此,如果您处于与我相同的位置,只需使用 virtualenv(即使您不喜欢这个概念,就像我一样)它可以为您节省未来的麻烦。
django - 使用 Django 1.8 时无法识别 manage.py 的“迁移”命令
使用“path/to/mySite/manage.py migrate”我得到
列出的命令是:
我相信从 Django 1.7 开始,“迁移”被添加为 manage.py 的本机命令。根据“pip list”和包文档,我肯定在使用 Django 1.8,并且在设置中明确调用了 django-admin.py 和 manage.py 的正确版本。
python - 由于 settings.py 中的 uwsgi 导入,无法使用 manage.py
我在生产服务器上使用 django 1.8 + uwsgi + nginx。uwsgi 处于帝王模式。我在 myapp/settings.py 中导入了 uwsgi python 模块,以便在修改代码时启用自动重载。据我了解,此 python 模块仅在 python 线程由 uwsgi worker 生成时才可用于导入。当我尝试手动使用 manage.py collectstatic 时,是导入 settings.py 然后无法导入 uwsgi.py。
有没有办法在使用 uwsgi python 模块的同时仍然能够使用 manage.py ?
我用来启用自动重载的代码(在 myapp/sttings.py 中):