Kategori : Django ...

12
04
2019

Django projesini Apache Wsgi ile çalıştırmak

Kategorisi : Apache,Django

SETTINGS.PY AYARLARI

#in settings.py add static dir

STATIC_ROOT = os.path.join(BASE_DIR, ‘static’)

#collect static to dir

python3 manage.py collectstatic

————————————-

DEPENDENCIES KURULUM

sudo apt-get -y install apache2 libapache2-mod-wsgi-py3 python3-django
sudo a2enmod wsgi
sudo service apache2 restart
sudo a2dissite 000-default
sudo service apache2 restart

——————————————

VIRTUALHOST AYARI

<VirtualHost *:80>
ServerName mysite
WSGIDaemonProcess ubuntu user=ubuntu group=ubuntu threads=5 python-path=”/var/www/html/mysite/mysite”
WSGIScriptAlias / /var/www/html/mysite/mysite/wsgi.py
Alias /static/ /var/www/html/mysite/static/
<Directory /var/www/html/mysite/static>
Require all granted
</Directory>

<Directory /var/www/html/mysite/mysite/>
WSGIProcessGroup ubuntu
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Require all granted
</Directory>
</VirtualHost>

——————————————

WSGI.PY AYARLARI

import os,sys
sys.path.append(‘/var/www/html’)
sys.path.append(‘/var/www/html/mysite’)

os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “mysite.settings”)

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


 

photo

Php, ajax, jquery, mootools web programlama. Linux, apache, lamp sunucu yönetimi. Cpanel, plesk, lxadmin panel kurulumlari.

19 / 10 / 2019, 19:31:51
Web yazilim, grafik
barbetto.com

Tunalioglu.org - 2015