Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14961 closed (fixed)

Cannot load admin interface static files when doing tutorial

Reported by: harriv+django@… Owned by: jezdez
Component: Contrib apps Version: 1.3-alpha
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Version is actually 1.3 beta 1

I started to explore Django by going thru the tutorial ( http://docs.djangoproject.com/en/dev/intro/tutorial01/ ).

However when I activated the admin interface (tutorial part 2) and opened the admin interface in browser, it looks pretty ugly. I poked a little and found out that no css file cannot be loaded. Both css files referenced in the 127.0.0.1:8000/admin/ page give 404 error. Urls for css files:

/static/admin/css/base.css
/static/admin/css/dashboard.css

Attachments (2)

urls.py (490 bytes) - added by Harriv 4 years ago.
settings.py (4.8 KB) - added by Harriv 4 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 Changed 4 years ago by jezdez

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

1.3 adds the new staticfiles app to serve static app files. When creating a new project with django-admin.py startproject mysite it should contain the django.contrib.staticfiles in INSTALLED_APPS. Can you check if that works for you (it does for me)?

comment:2 Changed 4 years ago by Harriv

django.contrib.staticfiles is there by default. I created the project following the steps in tutorial.

comment:3 Changed 4 years ago by Harriv

  • Component changed from Uncategorized to django-admin.py runserver

More information:

  • OS: Windows XP
  • Python version 2.7
  • Python installed in c:\python27\
  • Tutorial project in d:\harriv\djangotest\mysite\

comment:4 Changed 4 years ago by ramiro

Have by chance you set the DEBUG variable in setting.py to False?

comment:5 Changed 4 years ago by Harriv

DEBUG is True.

I tried minimal test case and just enabled the admin interface, no difference in results. I'll attach settings.py and urls.py.

Changed 4 years ago by Harriv

Changed 4 years ago by Harriv

comment:6 Changed 4 years ago by mlangley

I am also experiencing this issue when running 1.3 beta1 on Windows 7. I am new to Django and have not diverged from the steps in the tutorial.

Confirming the specific questions asked earlier:

  • django.contrib.staticfiles is enabled in INSTALLED_APPS
  • DEBUG variable in setting.py is set to True

comment:7 Changed 4 years ago by jezdez

  • Component changed from django-admin.py runserver to Contrib apps
  • milestone set to 1.3
  • Owner changed from nobody to jezdez
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:8 Changed 4 years ago by jezdez

OK, I was able to reproduce the bug, thanks for the report.

comment:9 Changed 4 years ago by jezdez

Seems like https://gist.github.com/d2b873845d5a49627f8e fixes the issue for me. Going to add tests tomorrow.

comment:10 Changed 4 years ago by Harriv

I can confirm that patch by jezdez fixes the problem. However there's another similar case in the same file, class AppDirectoriesFinder, method find_in_app.

comment:11 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [15119]) Fixed #14961 -- Revised staticfiles's prefix handling to make sure it runs on Windows. Also revised staticfiles tests to pass on Windows.

comment:12 Changed 4 years ago by ramiro

In [16285]:

Changed a bit the strategy used to test staticfiles finders so they can cope with even more differences in case of paths under Windows. Refs #14961

comment:13 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top