Skip to content

Instantly share code, notes, and snippets.

@mitulp236
Last active June 13, 2020 15:23
Show Gist options
  • Save mitulp236/20629389789d07851cb2022a178490e7 to your computer and use it in GitHub Desktop.
Save mitulp236/20629389789d07851cb2022a178490e7 to your computer and use it in GitHub Desktop.
Project Directory Structure
----------------------------
project-main-dir
- db.sqlite3
- venv
- requirement.txt
- myproject
- myproject
- settings.py
- wsgi.py
- urls.py
...
*****************************************************
deployment steps
-----------------------
sudo apt-get update
sudo apt-get install apache2 libapache2-mod-wsgi-py3
sudo vi/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
Alias /static /home/user/project-main-dir/myproject/static
<Directory /home/user/project-main-dir/myproject/static>
Require all granted
</Directory>
<Directory /user/project-main-dir/myproject/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-path=/home/user/project-main-dir/myproject python-home=/home/user/project-main-dir/venv
WSGIProcessGroup myproject
WSGIScriptAlias / /home/user/project-main-dir/myproject/myproject/wsgi.py
</VirtualHost>
if you using Sqlite DB then :
chmod 664 ~/myproject/db.sqlite3
sudo chown :www-data ~/myproject/db.sqlite3
sudo chown :www-data ~/myproject
else:
pass (No worries i will take care)
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment