我正在将我的django应用程序移到Heroku上,我想知道处理静态文件的正确方法是什么.我只是通过git将它们推送到Heroku吗?或者我应该将它们存储在SW3或其他东西上?另外,STATIC_ROOT应该是什么?
谢谢!
我有一个在Heroku/Cedar上运行的Django应用程序,按照https://devcenter.heroku.com/articles/django上的说明进行配置
按照Heroku的说明使用gunicorn无法包含Django管理员运行所需的静态文件.我可以将Procfile更改为"manage.py run_gunicorn"以进行本地开发,但这不会在Heroku上运行.
我已经搜索了所有的修复 - 是否有一些方法来包含管理静态文件而不会将其与我的其他静态文件一起扔在S3上?
我使用"git push heroku master"将一个django应用程序部署到了heroku,它工作得很好.
然后我使用"heroku create second-app -r staging"在同一个git上创建了第二个应用程序
并推送使用:git push staging master
当我打开第二个应用程序时,没有任何静态文件被拾取或加载(即没有css,js或图像工作)
这非常令人困惑 - 请帮忙!
我的设置文件如下
import os
import platform
import dj_database_url
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# This should work for any deployment
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..'))
ADMINS = (
('me', 'me@gmailcom'),
)
MANAGERS = ADMINS
# LOCAL SETTINGS
if platform.system() in ['Windows', 'Darwin']:
#EV = 'LOCAL'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': BASE_DIR + …Run Code Online (Sandbox Code Playgroud) 我试图在heroku中部署我的应用程序,但是当我最终尝试在heroku中运行我的应用程序时,我会在浏览器中执行此操作:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
Run Code Online (Sandbox Code Playgroud)
当我看到我的日志时,我得到了下一个:
2013-08-31T19:53:30.672416+00:00 heroku[api]: Enable Logplex by user@example.com
2013-08-31T19:53:30.700218+00:00 heroku[api]: Release v2 created by user@example.com
2013-08-31T19:58:41+00:00 heroku[slug-compiler]: Slug compilation started
2013-08-31T20:04:12.967456+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= service= status=502 bytes=
2013-08-31T20:04:13.161016+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=cristowip.herokuapp.com fwd="189.137.81.39" dyno= connect= …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的Django项目推送到Heroku,但它没有加载静态文件.
我用它来设置东西,一切都很好,但我无法解决静态文件的问题.
我的目录结构是这样的
help_the_needy
help_the_needy
__init__.py
settings.py
urls.py
views.py
wsgi.py
manage.py
Procfile
requirements.txt
static
css
font-awesome
fonts
img
js
templates
base.html
display_list2.html
index.html
Run Code Online (Sandbox Code Playgroud)
这是完整的代码(所有文件).
这是我的settings.py.
我尝试了很多东西来解决这个问题,但似乎没有任何工作.
当我按下它时会复制静态文件,但它不会加载它们.
有人可以指出我的错误吗?哪里错了?