所以我决定用appfog部署我的第一个django应用程序,在appfog中创建应用程序,下载源代码以便使用他们的项目结构,进行必要的更改并更新。一切顺利,直到我做python manage.py collectstatic
这收集了所有的静态文件,但我不能对静态文件进行更改,不能在模板中使用css。我只是不明白为什么。
在我的settings.py
ROOT_PATH = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(ROOT_PATH, 'static')
STATIC_DIR = /absolute/path/to/static
在urls.py中
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
我的项目结构看起来像这样,基本上是来自appfog的结构
-env
-.afignore
-settings.py
-templates
-static
-app1
我该如何解决这个问题?
答案 0 :(得分:0)
当你run python manage.py collectstatic
create static folder
copy the files inside staticfiles folder
时,对吗?
如果要进行更改,请不要尝试在静态文件夹中更改它。只需更改staticfiles文件夹中的文件即可。之后,运行python manage.py collectstatic在静态文件夹中进行更新。