I'm running Django in VPS using Apache2 and wsgi but I am getting a 'no module named: Django' error when I access the domain, what could be wrong? here's my default.conf in apache2,
<VirtualHost *:80>
. . .
Alias /static /home/sammy/myproject/static
<Directory /home/sammy/myproject/static>
Require all granted
</Directory>
<Directory /home/sammy/myproject/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-home=/home/sammy/myproject/myprojectenv python-path=/home/sammy/myproject
WSGIProcessGroup myproject
WSGIScriptAlias / /home/sammy/myproject/myproject/wsgi.py
Related
I have an internal Server Error 500 on my Django Server. When I check the error.log, I get the following error:
No WSGI daemon process called "..." has been configured: "..."
I hope someone can help me to fix this Error.
Here is my Apache config:
<VirtualHost *:80>
ServerAdmin ADMIN
ServerName DOMAIN
ErrorLog /home/USER/PROJECT/site/logs/error.log
CustomLog /home/PROJECT/PROJECT/site/logs/access.log combined
Alias /static /home/USER/PROJECT/static
<Directory /home/USER/PROJECT/static>
Require all granted
</Directory>
<Directory /home/USER/PROJECT/src/social>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess PROJECT python-path=/home/USER/PROJECT/ python-home=/home/USER/PROJECT/VIRTUALENV
WSGIProcessGroup PROJECT
WSGIScriptAlias / /home/USER/PROJECT/src/social/wsgi.py
</VirtualHost>
move your project path from /home/USER/PROJECT to /var/www/PROJECT
make sure you are chmod project folder --> sudo chmod -R 777 /project
if not work give your email to me for contact
<VirtualHost *:80>
# edit all /home/USER/PROJECT to /var/www/PROJECT
ServerAdmin ADMIN
ServerName DOMAIN
ErrorLog /home/USER/PROJECT/site/logs/error.log
CustomLog /home/PROJECT/PROJECT/site/logs/access.log combined
Alias /static /home/USER/PROJECT/static
<Directory /home/USER/PROJECT/static>
Require all granted
</Directory>
<Directory /home/USER/PROJECT/src/social> # here put path of where wsgi.py existing folder
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess PROJECT python-path=/home/USER/PROJECT/ python-home=/home/USER/PROJECT/VIRTUALENV
WSGIProcessGroup PROJECT
WSGIScriptAlias / /home/USER/PROJECT/src/social/wsgi.py
</VirtualHost>
I'm facing a problem when I run sudo a2ensite test.watermaps-eg.com.conf to add a new site to apache2 it gives me ERROR: Site test.watermaps-eg.com does not exist!
What I tried to do
Added the file test.watermaps-eg.com.conf inside sites-enabled.
Added the apache2 configurations inside the file.
<VirtualHost *:80>
ServerName https://test.watermaps-eg.com
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#innoventiq.com
ServerName test.watermaps-eg.com
DocumentRoot /home/ubuntu/test_water_maps_django
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/ubuntu/test_water_maps_django/static
<Directory /home/ubuntu/test_water_maps_django/static>
Require all granted
Order Allow,Deny
Allow from all
AllowOverride all
</Directory>
<Directory /home/ubuntu/test_water_maps_django/kml_files>
Require all granted
</Directory>
<Directory /home/ubuntu/test_water_maps_django/water_maps>
Require all granted
Order Allow,Deny
Allow from all
AllowOverride all
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess test_water_maps_django python-path=/home/ubuntu/test_water_maps_django python-home=/home/ubuntu/test_water_maps_django/venv
WSGIProcessGroup test_water_maps_django
WSGIScriptAlias / /home/ubuntu/test_water_maps_django/water_maps/wsgi.py
WSGIPassAuthorization On
</VirtualHost>
I ran the command sudo a2ensite test.watermaps-eg.com.conf and it returns the mentioned above error.
You might want to add the conf (test.watermaps-eg.com.conf) file inside /etc/apache2/site-available
before running the command
sudo a2ensite test.watermaps-eg.com
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
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 running a small django website with wsgi and apache on an ubuntu server.
I made a minor change to one of my template files in my Django app, and the change is not showing up on my server. However, if I run python manage.py runserver, and curl -l 127.0.0.1:8000, I can see the change. I've tried restarting apache, with no luck.
My urls.py for the page is just
url(r'^page/', TemplateView.as_view(template_name="page.html")),
I've verified that the change is not present by checking on other devices and using incognito mode.
My wsgi.py contains
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_site.settings")
application = get_wsgi_application()
And my /etc/apache2/sites-enabled/000-default.conf contains
<VirtualHost *:80>
ServerName www.site.com
ServerAlias site.com
ServerAdmin webmaster#site.com
Alias /static /opt/django_site/django_site/static
<Directory /opt/django_site/django_site/static>
Require all granted
</Directory>
<Directory /opt/django_site/django_site/django_site>
<Files wsgi.py>
Alias /static /opt/django_site/django_site/static
<Directory /opt/django_site/django_site/static>
Require all granted
</Directory>
<Directory /opt/django_site/django_site/django_site>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess django_site processes=2 threads=15 display-name=%{GROUP} python-path=/opt/django_site:/opt/django_site/django_site/lib/python2.7/site-packages
WSGIProcessGroup django_site
WSGIScriptAlias / /opt/django_site/django_site/django_site/wsgi.py
</VirtualHost>