Question on Django: Deploying on a production server Cannot find templates.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Question on Django: Deploying on a production server Cannot find templates.
Hello, I seem to have a problem with deploying Django on a production server using Apache. For those who don't know, Django is a is a web framework written in python coding and some html.
I seem to get this error - 'TemplateDoesNotExist at /" "/' .so for any url that requires a template. The other url seem to work fine e.g. (admin & admin/doc works because it does not require a template).
The strange thing is when I use Django Development server python manage.py runserver, The Django runserver can find the templates without any problem. I don't understand what the problem is.
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'booksdb' # Or path to database file if using sqlite3. DATABASE_USER = 'shehzad' # Not used with sqlite3. DATABASE_PASSWORD = 'arsenal' # Not used with sqlite3. DATABASE_HOST = 'localhost' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '3306' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/London'
# Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True
# Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '/var/www/html/mysite'
# 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 = '/html/mysite'
# 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/'
# Make this unique, and don't share it with anybody. SECRET_KEY = '@q&b$h$$2fm_bloj^uj(x#oio-mba@%@26(-kx#(oqs4%qqvi4'
# List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', )
TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. '/var/www/html/mysite/templates', '/var/www/html/mysite/templates/template_projects', )
from django.conf.urls.defaults import * from django.views.generic import list_detail from mysite.books.models import Publisher, Book from django.conf import settings #from mysite.views import requires_login, my_view1, my_view2, my_view3
# Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover()
# Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), )
Django tried loading these templates, in this order:
* Using loader django.template.loaders.filesystem.load_template_source: o /var/www/html/mysite/templates/current_datetime.html (File does not exist) o /var/www/html/mysite/templates/template_projects/current_datetime.html (File exists) * Using loader django.template.loaders.app_directories.load_template_source: o /usr/lib/python2.4/site-packages/django/contrib/admin/templates/current_datetime.html (File does not exist) o /usr/lib/python2.4/site-packages/django/contrib/admindocs/templates/current_datetime.html (File does not exist)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.