This is my first time trying to setup a webserver with Django. I've been banging my head against the wall in trying to set this up for a while now and I can't seem to find any resources that explains this in a newbie formatted step by step manner.
I've installed and setup apache and mod_wsgi on my EC2 instance. How do I map the URLs of my app set in my urls.py file to apache? Locally, I can get my app to work my entering 127.0.0.1:8000/flickr/photousers
by running it on the Django development server. I'm trying to be able to get this to work on my public dns as http://ec2-122-248-194-176.ap-southeast-1.compute.amazonaws.com/flickr/photouser
with apache and mod_wsgi.
When I restart my Apache server, I also get this error but with OK status [error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring
Below lists the relevant snippets
django.wsgi file
import os,sys apache_configuration = os.path.dirname(__file__) project = os.path.dirname(apache_configuration) workspace = os.path.dirname(project) sys.path.append(workspace) sys.path.append(/home/djangotest/flickr) #sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'flickr.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
httpd.conf file
<VirtualHost *.80> DocumentRoot /home/djangotest/flickr ServerName ec2-122-248-194-176.ap-southeast-1.compute.amazonaws.com ErrorLog /home/djangotest/flickr/logs/apache_error.log CustomLog /home/djangotest/flickr/logs/apache_access.log combined WSGIScriptAlias / /home/djangotest/flickr/apache/django.wsgi <Directory /home/djangotest/flickr/media> Order deny,allow Allow from all </Directory> <Directory /home/djangotest/flickr/apache> Order deny,allow Allow from all </Directory> LogLevel warn WSGIDaemonProcess ec2-122-248-194-176.ap-southeast-1.compute.amazonaws.com user=djangotest processes=2 threads=25 WSGIProcessGroup ec2-122-248-194-176.ap-southeast-1.compute.amazonaws.com Alias /media/ /home/djangotest/flickr/media/ </VirtualHost>
urls.py
from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: (r'flickr/', include('flickrphotobrowser.urls')), )
urls.py (located in my app)
from django.conf.urls.defaults import * from flickrphotobrowser.views import * urlpatterns = patterns('flickrphotobrowser.views', (r'^phototags/$', contenttags), (r'^photouser/$', contentuser), )
settings.py
ROOT_URLCONF = 'flickr.urls' TEMPLATE_DIRS = ( os.path.join(os.path.basename(__file__), 'templates'), #'home/nai/Projects/flickr/flickrphotobrowser/templates', # THIS IS FOR LOCAL ONLY ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'flickr.flickrphotobrowser', )
Should I include any other snippets to help troubleshoot the problem? Thanks.
'contenttags'
and'contentuser'