So, I'm learning how to use Django, and I'm using the Google App Engine. I have the latest Django directory in the same directory as my main one.
When I run it from my local, it works fine. But when I deploy it and run from a web page, I get a server error message.
Here is the code for my main.py and settings.py
main.py:
import os
import settings
from django.template import Context, Template
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, World!\n')
t = Template('It is now {% now "jS F Y H:i" %}')
c = Context({ })
self.response.out.write(t.render(c))
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
settings.py:
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TIME_ZONE = 'America/Whitehorse'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
Lucas source
share