My wedding website
- Install python 3.6
$ python3 -m venv venv
$ source venv/bin/activate
$ cd weddingwebsite
$ pip install -r requirements.txt
$ cd weddingwebsite
$ python manage.py migrate
$ python manage.py makemigrations
$ python manage.py createsuperuser
$ python manage.py collectstatic --noinput --clear
$ django-admin makemessages
$ django-admin compilemessages
##Test the app:
$ python manage.py runserver 80
OR
$ gunicorn -d -b 0.0.0.0:80 weddingwebsite.wsgi
then go to: localhost:80
- Install nginx:
$ sudo apt install nginx
- Create a config Nginx file:
$ touch /etc/nginx/sites-available/weddingwebsite
-
Paste the configuration from
weddingwebsite_nginx.conf
file into the file:/etc/nginx/sites-available/weddingwebsite
-
Link this file to the sites-enabled Nginx folder:
$ sudo ln -s /etc/nginx/sites-available/weddingwebsite /etc/nginx/sites-enabled
- Check if created configuratin does not contain any bugs by typing:
$ sudo nginx -t
If all is ok, you should see similar info:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
- Modify a gunicorn run command to be able to talk to Nginx:
$ gunicorn --daemon --workers=5 --bind unix:~/WeddingWebsite/weddingwebsite/weddingwebsite.sock weddingwebsite.wsgi
OR 7. Run gunicorn_run.sh script:
$ sudo chmod u+x gunicorn_run.sh
$ ./gunicorn_run.sh
- Modify
/etc/nginx/nginx.conf
as shown below:
user root www-data
- Restart Nginx:
$ systemctl restart nginx
- Open 0.0.0.0:80 in the browser, your app should be running smoothly right now : )