我正在尝试创建一个网站,但我不知道为什么我的一些CSS在页面上不起作用。我遵循了老师给我的格式,他的格式工作得如此之好,为什么我的不能。 在项目的urls.py中: from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('system/', include ('system.url
在我的项目中,我只是添加了新的安全方法,将.env从项目中分离到另一个文件夹,并采用新进程的使用。为此,我遵循了在我的应用程序中使用的python文档。
但是,即使按照建议,我也无法找到所有参数,因为我最终会出现以下错误:
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty
我的设置:
from dotenv import load_dotenv
env_path = Path('/home/user/configs') / '.env'
lo
我在Django上使用的是Jinja2版本2.10。我的css样式表出现了not found错误。我已经阅读了与Django中的Jinja2模板相关的Stackoverflow上的每个问题,并尝试了所有的答案,仍然没有成功。
我的jinja2配置文件(在我的Django项目的顶层):
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse
from jinja2 import Environment
# This enables us to use D
我的项目的Pipfile中有django-heroku作为package。
django-heroku的has文件中有gunicorn作为dev-package。请参阅:
我希望在我的项目中运行pipenv install --dev之后,我可以运行pipenv run gunicorn。
但它会引发以下错误:
Error: the command gunicorn could not be found within PATH or Pipfile's [scripts].
如果dev依赖项不可用,install --dev的意义是什么?
我使用的是Django 1.3,app中的静态文件令人困惑。我在做什么: 1)设置
STATIC_ROOT = as path to directory 'static' in my project
STATIC_URL = '/static/'
2)在我的urls.py中服务
if settings.DEBUG:
urlpatterns += patterns(
'',
url(r'^static/(?P<path>.*)$', 'django.views.static