I am having issues trying to deploy my site,.I am still new in both Django , their is a tutorial I have been following on how to deploy the site, Everything works fine except it renders the default Apache page instead of my site when I restart the server.
Here is my project directory
Alias /static /home/brian/src/static
<Directory /home/brian/src/static>
Require all granted
</Directory>
Alias /media /home/brian/src/media
<Directory /home/brian/src/media>
Require all granted
</Directory>
<Directory /home/brian/src/src>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/brian/src/src/wsgi.py
WSGIDaemonProcess django_app python-path=/home/brian/src python-home=/home/brian/src/venv
WSGIProcessGroup django_app
Related
I did set up two websites (hosted locally). I'm on windows so config may look odd.
WSGIPythonHome "C:/var/www/magazyn/env39"
WSGIPythonPath "C:/var/www/magazyn/venv/Lib/site-packages;C:/var/www/magazyn/rootkat/"
ServerName www.magazyn-stolarz.pl
LoadFile "C:/Python39/python39.dll"
LoadModule wsgi_module "C:/var/www/magazyn/env39/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd"
WSGIScriptAlias /awizacje "C:/var/www2/awizacje/rootkat/awizacje/wsgi.py"
WSGIScriptAlias / "C:/var/www/magazyn/rootkat/magazyn/wsgi.py"
<Directory "C:/var/www2/awizacje/rootkat/awizacje/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /statica "C:/var/www2/static/"
<Directory "C:/var/www2/static/">
Require all granted
</Directory>
<Directory "C:/var/www/magazyn/rootkat/magazyn/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static "C:/var/www/static/"
<Directory "C:/var/www/static/">
Require all granted
</Directory>
With that configuration base site works perfectly ("pc-name/") but the second one ("pc-name/awizacje") does not. Main url works like it should but every button sends me to ("pc-name/button-url") and not ("pc-name/awizacje/button-url"). I have set ROOT_URLCONF = 'awizacje.urls' in settings.py. Is there something I am missing? Any way I should change settings to take base url into account?
The problem were hardcodded urls. I changed it so it will use django urls into account.
i'm trying to deploy django application using apache & mod_wsgi on centos 7.
I have added the following lines in the httpd.conf file:
Alias /robots.txt /home/centos/sunlife/static/robots.txt
Alias /favicon.ico /home/centos/sunlife/static/favicon.ico
#Alias /media/ /path/to/mysite.com/media/
Alias /static/ /home/centos/sunlife/static/
<Directory /home/centos/sunlife/static>
Require all granted
</Directory>
#<Directory /path/to/mysite.com/media>
#Require all granted
#</Directory>
WSGIScriptAlias / /home/centos/sunlife/sunlife/wsgi.py
<Directory /home/centos/sunlife/sunlife>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
While trying to access the ip, I am getting Forbidden You don't have permission to access / on this server.
I installed Django on a VPS and Apache2,
but when I want to upload a file (Avatar with userena)
I have this error Permissions refused: 'var/www/static'
but my css files and others have Loaded (file in the static directory of my project),
And the directory of my django project is in /home/user/... and not in /var/www, I tried a "DocumentRoot" change in `etc/apache2/site-available/000-Default.conf..'But it does not work
My conf in 000-default.conf :
```
ServerName www.site_example.com
ServerAdmin webmaster#site_example
DocumentRoot home/ubuntu/my_site/site_example/
Alias /static /home/ubuntu/my_site/site_example/static
<Directory /home/ubuntu/my_site/site_example/static >
Require all granted
</Directory>
<Directory "/home/ubuntu/my_site/site_example">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess site_example python-path=/home/ubuntu/my_site/site_example python-home=/home/ubuntu/web_sites/my_site__venv
WSGIProcessGroup site_example
WSGIScriptAlias / /home/ubuntu/my_site/site_example/wsgi.py
```
I'm trying to setup Django (Django 1.9.6) on Apache (Apache 2.4.10) in my vps (ubuntu server 15.04).
I followed this guide: HERE
Unfortunately when I try to visit my website, the server return this error (403 Forbidden):`
[authz_core:error] AH01630: client denied by server configuration: /home/user/proj/proj/wsgi.py
I searched everywhere for a solution but everything I tried didn't work.
this is my /etc/apache2/sites-available/000-default.conf file:
Alias /static /home/user/proj/Gestione/static
<Directory /home/user/proj/Gestione/static>
Order deny,allow
Allow from all
</Directory>
<Directory /home/user/proj/proj>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
WSGIDaemonProcess proj python-path=/home/user/proj:/home/user/.local/lib/python3.4/site-p$
WSGIProcessGroup proj
WSGIScriptAlias / /home/user/proj/proj/wsgi.py
Then i found this code on /etc/apache2/apache2.conf, I don't know if this could create problems:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
This is my wsgy.py:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")
application = get_wsgi_application()
I'm NOT using virtualenv
Thanks for help
In Apache 2.4, you should use Require all granted instead of Order deny,allow and Allow from all.
It looks like you are using the old style in two places in 000-default.conf. Try updating it to:
<Directory /home/user/proj/Gestione/static>
Require all granted
</Directory>
<Directory /home/user/proj/proj>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
I am using libapache2-mod_wsgi for deploying my django app. I wrote httpd.conf as follows:
Alias /static/ /home/ubuntu/similarkind/similarkind/static/
<Directory /home/ubuntu/similarkind/similarkind/static>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /home/ubuntu/similarkind/similarkind/wsgi.py
WSGIPythonPath /home/ubuntu/similarkind:/home/ubuntu/pysushu/lib/python2.7/site-packages
<Directory /home/ubuntu/similarkind/similarkind>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
Well my app is working just fine but css and javascript is not showing up.
I have my css and js in static folder. Also my directory structure for app looks like
/similarkind
/static
/foundation-3
/stylesheets
/js
/jquery-ui
/css
/js
Can anyone tell what thing am I missing?