django 1.8 cannot load css in development server -
i have problem load css admin site. setup django 1.8 , run development server apparently cannot load css 500 error code. cannot figure out problem.
this setting.py
import os base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # quick-start development settings - unsuitable production # see https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # security warning: keep secret key used in production secret! secret_key = secret_key # security warning: don't run debug turned on in production! debug = true allowed_hosts = [] # application definition installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ) middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', 'django.middleware.security.securitymiddleware', ) root_urlconf = 'rnd.urls' templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [], 'app_dirs': true, 'options': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] wsgi_application = 'rnd.wsgi.application' # database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'rnd.sqlite3'), } } # internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ static_url = '/static/'
this error get:
traceback (most recent call last): file "c:\python27\lib\wsgiref\handlers.py", line 85, in run self.result = application(self.environ, self.start_response) file "c:\python27\lib\site-packages\django\contrib\staticfiles\handlers.py", l ine 64, in __call__ return super(staticfileshandler, self).__call__(environ, start_response) file "c:\python27\lib\site-packages\django\core\handlers\wsgi.py", line 189, n __call__ response = self.get_response(request) file "c:\python27\lib\site-packages\django\contrib\staticfiles\handlers.py", l ine 54, in get_response return self.serve(request) file "c:\python27\lib\site-packages\django\contrib\staticfiles\handlers.py", l ine 47, in serve return serve(request, self.file_path(request.path), insecure=true) file "c:\python27\lib\site-packages\django\contrib\staticfiles\views.py", line 40, in serve return static.serve(request, path, document_root=document_root, **kwargs) file "c:\python27\lib\site-packages\django\views\static.py", line 66, in serve content_type, encoding = mimetypes.guess_type(fullpath) file "c:\python27\lib\mimetypes.py", line 290, in guess_type init() file "c:\python27\lib\mimetypes.py", line 351, in init db.read_windows_registry() file "c:\python27\lib\mimetypes.py", line 254, in read_windows_registry _winreg.openkey(hkcr, subkeyname) subkey: typeerror: must string without null bytes or none, not str [08/jul/2015 11:04:29]"get /static/admin/css/base.css http/1.1" 500 59
this url.py
from django.conf.urls import include, url django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), ]
the solution:
the root cause because of corrupted keys in windows registry. have reinstalled python 2.7 library , solved problem.
the root cause because of corrupted keys(have empty string/null value) in windows registry. have reinstalled python 2.7 library , solved problem.
Comments
Post a Comment