Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django can';找不到管理员的静态文件_Python_Django_Django Staticfiles - Fatal编程技术网

Python Django can';找不到管理员的静态文件

Python Django can';找不到管理员的静态文件,python,django,django-staticfiles,Python,Django,Django Staticfiles,你好,先谢谢你 我已经在Bluehost上安装了django。看起来一切正常,但是管理模块没有看到静态文件,因此管理页面没有格式化 我是一个noob,我不知道从哪里开始故障排除,任何帮助都是感激的。请让e知道哪些信息有助于提供 <pre> # Django settings for acme project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Nam

你好,先谢谢你

我已经在Bluehost上安装了django。看起来一切正常,但是管理模块没有看到静态文件,因此管理页面没有格式化

我是一个noob,我不知道从哪里开始故障排除,任何帮助都是感激的。请让e知道哪些信息有助于提供

    <pre>
        # Django settings for acme project.

    DEBUG = True
    TEMPLATE_DEBUG



= DEBUG

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'XXXXXXX',                      # Or path to database file if using sqlite3.
        'USER': 'XXXXXXXX',                      # Not used with sqlite3.
        'PASSWORD': 'XXXX',                  # Not used with sqlite3.
        'HOST': '',                # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                 # Set to empty string for default. Not used with sqlite3.
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    'home/public_html/chicken/static'
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '#rrbgcl4dl5sr$7)5pb5)b+4tt$9glpj)zs0+--edu!id9&amp;vpt'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'acme.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'acme.wsgi.application'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}
</pre>

django.fcgi (in a sub directory under public_html)

<pre>
#!/home/acmefant/bin/python
import sys, os 
sys.path.insert(0,"/home/acmefant/django_src") 
sys.path.insert(0,"/home/acmefant/django_projects/acme") 
from flup.server.fcgi import WSGIServer 
os.environ['DJANGO_SETTINGS_MODULE'] = 'acme.settings' 
from django.core.handlers.wsgi import WSGIHandler 
WSGIServer(WSGIHandler()).run()
</pre>
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_URI} !(mysite.fcgi)
RewriteRule ^(.*)$ mysite.fcgi/$1 [L]

#acme项目的Django设置。
调试=真
模板调试
=调试
管理员=(
#(‘你的名字’、‘你的名字’)_email@example.com'),
)
经理=管理员
数据库={
“默认值”:{
“ENGINE”:“django.db.backends.mysql”,#添加“postgresql_psycopg2”、“mysql”、“sqlite3”或“oracle”。
'NAME':'XXXXXXX',#或数据库文件的路径(如果使用sqlite3)。
“用户”:“XXXXXXXX”,不与sqlite3一起使用。
“密码”:“XXXX”,不与sqlite3一起使用。
'HOST':'',将localhost设置为空字符串。不与sqlite3一起使用。
“端口”:“”,默认设置为空字符串。不与sqlite3一起使用。
}
}
#此安装的本地时区。可在此处找到选择:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
#尽管并非所有操作系统上都提供所有选项。
#在Unix系统上,值None将导致Django使用相同的值
#时区作为操作系统。
#如果在Windows环境中运行,则必须将其设置为与
#系统时区。
时区='美国/芝加哥'
#此安装的语言代码。可在此处找到所有选项:
# http://www.i18nguy.com/unicode/language-identifiers.html
语言代码='en us'
站点ID=1
#如果您将其设置为False,Django将进行一些优化,以便
#装载机器。
使用_I18N=True
#如果将其设置为False,Django将不会格式化日期、数字和日期
#根据当前区域设置设置日历。
使用\u L10N=True
#如果将其设置为False,Django将不使用时区感知的日期时间。
使用_TZ=True
#保存用户上载文件的目录的绝对文件系统路径。
#示例:“/home/media/media.lawrence.com/media/”
媒体根=“”
#处理从媒体根目录提供的媒体的URL。请务必使用
#尾随斜杠。
#示例:“http://media.lawrence.com/media/", "http://example.com/media/"
媒体URL=“”
#应收集到目录静态文件的绝对路径。
#你自己不要把任何东西放在这个目录里;存储静态文件
#在应用程序的“static/”子目录和STATICFILES\u DIRS中。
#示例:“/home/media/media.lawrence.com/static/”
静态_根=“”
#静态文件的URL前缀。
#示例:“http://media.lawrence.com/static/"
静态URL='/STATIC/'
#静态文件的其他位置
静态文件\u目录=(
#在此处放置字符串,如“/home/html/static”或“C:/www/django/static”。
#始终使用前斜杠,即使在Windows上也是如此。
#不要忘记使用绝对路径,而不是相对路径。
“主/公共\u html/chicken/static”
)
#知道如何在中查找静态文件的查找器类列表
#不同地点。
静态文件\u查找程序=(
“django.contrib.staticfiles.finders.FileSystemFinder”,
“django.contrib.staticfiles.finders.AppDirectoriesFinder”,
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
#让它独一无二,不要与任何人分享。
密钥='#rrbgcl4dl5sr$7)5pb5)b+4tt$9glpj)zs0+--edu!id9&;vpt'
#知道如何从各种源导入模板的可调用项列表。
模板加载程序=(
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
#'django.template.loaders.eggs.Loader',
)
中间件\u类=(
'django.middleware.common.CommonMiddleware',
“django.contrib.sessions.middleware.SessionMiddleware”,
“django.middleware.csrf.CsrfViewMiddleware”,
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
#取消注释下一行以获得简单的点击保护:
#'django.middleware.clickjacking.xFrameOptions中间件',
)
ROOT_URLCONF='acme.url'
#Django的runserver使用的WSGI应用程序的Python点路径。
WSGI_应用程序='acme.WSGI.APPLICATION'
模板目录=(
#在此处放置字符串,如“/home/html/django_templates”或“C:/www/django/templates”。
#始终使用前斜杠,即使在Windows上也是如此。
#不要忘记使用绝对路径,而不是相对路径。
)
已安装的应用程序=(
“django.contrib.auth”,
“django.contrib.contenttypes”,
“django.contrib.sessions”,
“django.contrib.sites”,
“django.contrib.messages”,
“django.contrib.staticfiles”,
#取消注释下一行以启用管理员:
“django.contrib.admin”,
#取消注释下一行以启用管理文档:
#“django.contrib.admindocs”,
)
#日志记录配置示例。唯一有形的伐木
#此配置执行的是向发送电子邮件
#当DEBUG=False时,站点管理每个HTTP 500错误。
#看http://docs.djangoproject.com/en/dev/topics/logging 对于
#有关如何自定义日志记录配置的更多详细信息。
日志记录={
“版本”:1,
“禁用现有日志记录器”:False,
“过滤器”:{
“要求调试错误”:{
“()”:“django.utils.log.requiredBugFalse”
}
},
“处理程序”:{
“邮件管理员”:{
“级别”:“错误”,
“过滤器”:[“需要调试\u错误”],
'class':'django.utils.log.AdminEmailHandler'
}
},
“伐木工人”:{
“django.request”:{
“处理程序”:[“邮件管理员”],
“级别”:“错误”,
"传播":对,,
},
}
}
django.fcgi(位于public_html下的子目录中)
ADMIN_MEDIA_PREFIX = '/static/admin/'
#!/home/acmefant/bin/python 导入系统,操作系统 sys.path.insert(0,“/home/acmefant/django_src”) sys.path.insert(0,“/home/acmefant/django_projects/acme”) fro
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_URI} !(mysite.fcgi)
RewriteRule ^(.*)$ mysite.fcgi/$1 [L]