Python ';静态文件';不是注册的标记库:这些解决方案不';行不通
我对Heroku和Django不熟悉。Python ';静态文件';不是注册的标记库:这些解决方案不';行不通,python,django,heroku,Python,Django,Heroku,我对Heroku和Django不熟悉。 现在我在中间。< BR> 当我访问https://(…secret…)-app-123.herokuapp.com/db, 我得到了以下错误: 'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz 然后我找到了。 然而,这些解决方案并不能解决我的问题 首先
现在我在中间。< BR> 当我访问https://(…secret…)-app-123.herokuapp.com/db,
我得到了以下错误:
'staticfiles' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
i18n
l10n
log
static
tz
然后我找到了。然而,这些解决方案并不能解决我的问题 首先,我改变了
{% load staticfiles %}
到
。。。在db.html
中
它给了我:
run python manage.py migrate
Running python manage.py migrate on ⬢ (...secret...)-app-123... up, run.3361 (Free)
Operations to perform:
Apply all migrations: admin, auth, contenttypes, hello, sessions
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
由于错误消息告诉我运行manage.py makemigrations
,我运行了:
manage.py makemigrations
Traceback (most recent call last):
File "C:\Users\xxxxx\python-getting-started\manage.py", line 8, in ?
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
没有模块?Django已安装在我的机器上。
我不知道该怎么办,所以我在本地机器上更新了Django:
C:\Users\xxxxx\python-getting-started>pip install django --upgrade
Requirement already up-to-date: django in c:\users\xxxxx\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (3.1.2)
Requirement already satisfied, skipping upgrade: sqlparse>=0.2.2 in c:\users\xxxxx\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from django) (0.4.1)
Requirement already satisfied, skipping upgrade: pytz in c:\users\xxxxx\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from django) (2020.1)
Requirement already satisfied, skipping upgrade: asgiref~=3.2.10 in c:\users\xxxxx\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from django) (3.2.10)
。。。但是,这并不能解决我的问题
我还补充说:
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
VENV_PATH = os.path.dirname(BASE_DIR)
STATIC_ROOT = os.path.join(VENV_PATH, 'static_root')
在settings.py的末尾,但它也不起作用
我还能做什么
关于您的信息,到目前为止没有任何错误。
如果你有任何错误,你甚至到不了这里
请随意询问我的设置,输入这个,输入那个,等等。
提前谢谢。您应该使用虚拟环境。在虚拟环境中管理django项目将更容易。谢谢。我刚刚按照说明创建了一个名为djev
的虚拟环境。结果如下:(djev)C:\WINDOWS\system32>conda list#环境中的包位于C:\ProgramData\Anaconda3\envs\djev:##Name Version Build Channel alabaster 0.7.12 py37_0:django 2.2.5 py37_1。。。现在该怎么办manage.py makemigrations
仍然会显示错误。当我启动Heroku Django指令时,我正在使用base
环境。我必须从头开始重新做整个过程吗?
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
VENV_PATH = os.path.dirname(BASE_DIR)
STATIC_ROOT = os.path.join(VENV_PATH, 'static_root')