python - Is it possible to serve a static html page at the root of a django project? -
i have django app hosted on pyhtonanywhere. app resides @ username.pythonanywhere.com/myapp
. serve static html page @ username.pythonanywhere.com
. possible? serve index linking /myapp
, /myapp2
, , other future apps.
i can't seem find info on how this, assume have modify mysite/mysite/urls.py
navigating root gives me 404 messages failing find match in urls.
urlpatterns = [ url(r'^/$', ???), url(r'^admin/', include(admin.site.urls)), url(r'^myapp/', indluce('myapp.urls')). ]
the previous best guess (a bad 1 know). should (correct me if i'm wrong) match root url, have no idea how "hey django static file", or static html should live, or how tell django lives.
try not cut head off. i'm brand new django.
p.s. i'm using django 1.8 in virtualenv on pa
of course can. in cases need render template, use templateview. example:
url(r'^$', templateview.as_view(template_name='your_template.html'))
i order url patterns most specific least specific avoid unexpected matches:
from django.views.generic import templateview urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^myapp/', include('myapp.urls')), url(r'^$', templateview.as_view(template_name='your_template.html')), ]
as far django looks templates, it's configuration tell django look: https://docs.djangoproject.com/en/1.8/topics/templates/#configuration
Comments
Post a Comment