我已经经历了stackoverflow几天寻找我的问题的答案。
我正与我的同事一起开展Django项目,前几天我们的CSS停止了工作。根据我们的记忆,我们都没有触及与CSS相关的任何内容,但是管理页面和我们的CSS都不起作用。
我们不断得到这个:
[18/Feb/2014 06:45:18] "GET /static/css/style.css HTTP/1.1" 302 0
SETTINGS.PY “”” AGBO的设置风扇项目 “”“
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'fandb', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # 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.
}
}
TIME_ZONE = 'America/Chicago'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
SECRET_KEY = '******'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.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',
)
ROOT_URLCONF = 'fan.urls'
WSGI_APPLICATION = 'fan.wsgi.application'
TEMPLATE_DIRS = (
'templates'
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'fanApp',
)
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,
},
}
}
main.html调用css
link rel="stylesheet" type="text/css" href="http://localhost:1234/static/style.css" media="screen"
urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$','fanApp.views.home', name='home'),
#Tweet
url(r'^newTweet$', 'fanApp.views.newTweet'),
url(r'^showAllTweets$','fanApp.views.showAllTweets'),
url(r'^deleteTweetFromDatabase/(.+)','fanApp.views.deleteTweetFromDatabase'),
#Repo
url(r'^showRepo$', 'fanApp.views.viewRepo'),
url(r'^deleteTweetFromRepo/(.+)','fanApp.views.deleteTweetRepo'),
url(r'^addTweetToRepo/(.+)','fanApp.views.addTweetRepo'),
#Algorithm
url(r'^viewAlgor','fanApp.views.viewAlgor'),
#Analyzers
url(r'^analyzer','fanApp.views.analyzer'),
#Login/Logout
url(r'^login', 'django.contrib.auth.views.login'),
url(r'^logout', 'django.contrib.auth.views.logout',{'next_page':'/'}),
#WP Blogs
url(r'^cocoaosx','fanApp.views.cocoaosx'),
url(r'^agboBlog','fanApp.views.agboBlog'),
#Admin
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
#Default
url(r'accounts/profile/', 'fanApp.views.showAllTweets'),
url(r'^(.+)$', 'fanApp.views.defaultAction'),
)
我真的很感激任何帮助,这让我们两个都疯了,我们无法在任何地方找到问题。
答案 0 :(得分:0)
问题很可能是最终的全能网址:
url(r'^(.+)$', 'fanApp.views.defaultAction'),
最好使用像PageFallbackMiddleware这样的中间件。