Link to video: </youtu.be/Sa_kQheCnds> (in brackets you'll find the corresponding times in the video) Step by step summary: 1) (4:50) Create a Linode account, log in. Create a new Linode, choose Ubuntu, choose Region, choose Nanode (5USD/month). Give a name for Linode Label (ex: django-server), create Root Password. 2) (8:00) Select your Linode âdjango-serverâ and copy the SSH Access address youâll find in âNetworkingâ tab. 3) (10:00) In term window SSH to your linux server. Weâll then update and upgrade our remote linux server, to make sure all is up to date (security patches, etc). 4) (12:10) set hostname (weâll call it django-server), update /etc/hosts file. 5) (14:20) add limited user: we are now root user, which could be âdangerousâ, so we prefer creating a limited user, and we will be able to access admin settings by using SUDO. Log out and then log in again as limited user. 6) (16:27) Create SSH key base authentication, so that we do not have to enter password each time we log in (and it is also more secure). 7) (26:55) Install and configure a firewall (UFW or âuncomplicated firewallâ). 8) (29:15) Starting Deployment. 9) (29:20) Transfer the web application to web server (we are going to push it from our local machine using term window). 10) (30:10) Activate venv on local machine + creating a requirements.txt file (file which will contain a list with name and version for each python dependency necessary to the web app). Command âpip freezeâ to find out which dependencies are in use. 11) (33:00) Transfer django project from local machine to server (with scp which is similar to ftp). 12) (34:50) Create a venv on remote server: Install Python3, install+create+activate venv (so that we can install all our dependencies for the web app only). 13) (37:10) Install dependencies with requirements.txt file. Modify settings in settings.py file. (STATIC files (39:15) /home/anneest/django_project/static - css, fonts, img, js, main.css). 14) (40:38) Running server and web app for first time from web browser! Running tests (create new post, create new user, go to admin, etc) 15) (44:35) Letâs now run our web app on Apache server (and not a django server). 16) (45:20) Installation of Apache web server and WSGI (Web Service Gateway Interface, which will allow Apache to talk to Python) 17) (46:05) Configuration of Apache server (/etc/apache2/site-available/000-default.conf). 18) (55:40) Giving Apache permissions (group ownership + r/w access) to our sqlite3 database, django_project, and /media folder. 19) (58:50) Modifying environment variables to config files (easier way to do it with Apache). (Secret key, email username and password, in future: database username and password when weâll use PostgreSQL). This sensitive information is going to be stored in /etc/config.json 20) (1:02:50) Modifying /django_project/django_project/settings.py (loading config.json, switch off debug mode, editing access to EMAIL_USER and EMAIL_PASS according to config.json) 21) (1:07:07) Allow HTTP traffic on our web app (disallow on port 8000 which we had so far). UFW commands. 22) (1:07:53) Restart Apache server, and test our web app in the browser again! 23) (1:10:30) Debugging. Correcting permissions to our django_project folder (chmod 775). Further testing of the web app online. 24) CHECK LIST for deployment with Django here: /docs.djangoproject.com/en/2.1/howto/deployment/checklist/ Cheers and happy deployment :-) Anne
I just finished a great Django tutorial from Corey Schafer on Youtube. You can find the complete tutorial here: </www.youtube.com/playlist?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p> The best IMO is that in the last video, Corey goes through actual deployment of the blog which we created during the tutorial. It's a looong video of 1 hour and 22 minutes. So I have summarised this last video in points, so that it's possible to keep track of the progress, and also go back on the video to specific points, since I added the time for each step in the video. Check out my next post for this summary! Cheers and happy deployment, Anne
You can put any information here you'd like.
- Latest Posts