I am new to django. I am using Google App-engine and Google CloudSQL to serve a django1.2 project. I’ve been following the tutorial here and have hit a snag.
I enabled the admin back end in my settings.py, but when I go to http://www.examplesite.com/admin/ the css files aren’t found.
The admin html page loads fine, but the static files give a 404.
Here’s my app.yml:
application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: true
libraries:
- name: django
version: "1.2"
builtins:
- django_wsgi: on
I left these as default in settings.py:
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
I know the files are located at google_appengine/lib/django_1_2/django/contrib/admin/media/
Do I need to copy those static resources into my project directory somewhere? Or do I have a setting wrong?
In GAE you need to make the static files accessible in your app.yaml
https://developers.google.com/appengine/docs/python/config/appconfig#Static_Directory_Handlers