python - Amazon EC2 Django Static Files configuration -


configured amazon ec2 yesterday. went through holy complete google. no luck no work around. unsure next needs test static files running.

i share working local system django configuration:

settings.py

base_dir = os.path.dirname(os.path.dirname(__file__))  installed_apps = (     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'ui', )  template_dir = (     os.path.join(base_dir, 'website/ui/templates/'), )  staticfiles_dirs = (     os.path.join(base_dir, "website/ui/static"), ) 

now thing template_dir working fine.

index.html

{% load static staticfiles %} ... ... <img src="{% static 'images/logo.jpg' %}" width="100" height="100" /> ... ... 

specific configuration did on ec2 is:

i have followed instructions blog: deploying django on aws

now /etc/apache2/sites-enabled contains test_site.com.conf below data:

wsgiscriptalias / /home/ubuntu/v1/app-info/app/website/website/wsgi.py wsgipythonpath /home/ubuntu/v1/app-info/app/website <directory /home/ubuntu/v1/app-info/app/website/website/>     <files wsgi.py>         order deny,allow         require granted     </files> </directory>  <directory /home/ubuntu/v1/app-info/app/website/ui/static>     allow </directory>  errorlog /var/log/apache2/error.log 

and gives me page not found (404) for static files only

can guide on howto fix :|

okay after doing many trials, have come conclusion major issue in apache configuration.

replacing /etc/apache2/sites-enabled/test_site.com.conf content below fixed problem.

wsgiscriptalias / /home/ubuntu/v1/website-info/app/website/website/wsgi.py wsgipythonpath /home/ubuntu/v1/website-info/app/website  <directory /home/ubuntu/v1/website-info/app/website/website>     <files wsgi.py>         require granted     </files> </directory>  alias /static/ /home/ubuntu/v1/website-info/app/website/ui/static/  <directory /home/ubuntu/v1/website-info/app/website/ui/static>     require granted </directory>  errorlog /var/log/apache2/error.log 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -