Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysite/
- __init__.py
- MySiteDB
- manage.py
- settings.py
- urls.py
- myapp/
- __init__.py
- admin.py
- models.py
- test.py
- views.py
- templates/
- index.html
- <head>
- <title>Degree Planner</title>
- <script type="text/javascript" src="/scripts/JQuery.js"></script>
- <script type="text/javascript" src="/media/scripts/sprintf.js"></script>
- <script type="text/javascript" src="/media/scripts/clientside.js"></script>
- </head>
- (r'^admin/', include(admin.site.urls)),
- (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'media'})
- (r'^.*', 'mysite.myapp.views.index'),
- TypeError at /admin/auth/
- 'tuple' object is not callable
- MEDIA_ROOT = '/media/'
- MEDIA_URL = 'http://127.0.0.1:8000/media'
- ROOT_PATH = os.path.normpath(os.path.dirname(__file__))
- (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.join(settings.ROOT_PATH, 'site_media')}),
- <script type="text/javascript" src="/media/JQuery.js"></script>
- <script type="text/javascript" src="/media/sprintf.js"></script>
- <script type="text/javascript" src="/media/clientside.js"></script>
- mysite/
- site_media/
- JQuery.js
- sprintf.js
- clientside.js
- __init__.py
- settings.py
- manage.py
- -- etc
- myapp/
- -- app files, etc
- Page not found: /media/sprintf.js
- mysite/
- site_media/
- css/
- js/
- images/
- ...
- ROOT_PATH = os.path.normpath(os.path.dirname(__file__))
- url(r'^media/(?P<path>.*)$', "django.views.static.serve", {'document_root':
- os.path.join(settings.ROOT_PATH, 'site_media')})
- mysite.com/
- media/ - User media, this goes in settings.MEDIA_ROOT
- static/ - This is your static content folder
- css/
- js/
- images/
- templates/
- project/ - This is your Django project folder
- __init__.py
- manage.py
- settings.py
- myapp/
- __init__.py
- ...files..py
- (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.getenv('STATIC_DIR')})
- if settings.DEBUG:
- urlpatterns += patterns('',
- (r'^media/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': settings.MEDIA_ROOT}),
- )
- # Absolute path to the directory that holds media.
- # Example: "/home/media/media.lawrence.com/"
- MEDIA_ROOT = '/srv/nginx/<sitename>/media/'
- # 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 = 'http://127.0.0.1:8000/media/'
- TEMPLATE_CONTEXT_PROCESSORS = (
- # I've taken out my other processors for this example
- "django.core.context_processors.media",
- )
- <link rel="stylesheet" href="{{ MEDIA_URL }}css/form.css" />{% endblock %}
- /srv/nginx/<sitename>
- /media <-- MEDIA_ROOT/MEDIA_URL points to here
- /css
- base.css
- form.css
- /img
- /js
- import os
- PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
- MEDIA_ROOT = os.path.join(PROJECT_PATH, 'site_media')
- MEDIA_URL = '/media/'
- /media
- favicon.ico
- robots.txt
- /upload # user uploaded files
- /js # global js files like jQuery
- /main_app
- /js
- /css
- /img
- /other_app
- /js
- /css
- /img
- import os
- import annoying
- MEDIA_ROOT = os.path.join(os.path.dirname(__file__), "media")
- MIDDLEWARE_CLASSES = (
- 'annoying.middlewares.StaticServe',
- #...
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement