Welcome to my blog!
I am excited to share my first deployed website with you, but above all, I am proud of how far I have come! A lot of water has flown under the bridges from my first "Rock, Paper, Scissors" game in Python using just if-conditionals and a couple of input() functions. From that time, I have learned much more, such as how to use a Linux terminal so well that sometimes I do need to touch the mouse, what is the Git version control system, the OOP model, the class inheritance, SQLite, PostgreSQL, Flask, and finally Django! Well..."finally"...as one of my dearest friends told me, "Writing on an undeployed app, it is still somewhat like a toy project": therefore, I decided to learn how to deploy a Django web app online, and I would like to share my personal experience with you.
The first step was to choose the right platform: there are dozens of cloud providers offering a range of services, which usually include virtual servers, scalable storage, databases, isolated networks, secure identity and access management, and some monitoring/logging tools. However, even though all of them include a free tier, practically speaking you will need to pay at least a small monthly fee if you want to keep running your application and not lose everything. Therefore, after careful consideration and a disappointing experience using another platform, I decided to go for Render. In my opinion, it is extremely easy to use thanks to its intuitive and comprehensive Dashboard, which allows you to clone a project from GitHub and set up a DB in just a couple of minutes. Above all, it's very cheap: today, at the beginning of October 2024, I paid only $7!
Therefore, the second step is to create a DB: I know it might seem counterintuitive not to start by cloning the project, but just like when you prepare a cake, you want first thing first all the ingredients on the table. In the same way, I think it is better to have everything ready before starting to deploy the app itself. The procedure is very straightforward: you have just to give it a name, set your closest region and choose the most suitable plan/size for yourself: at the moment, I am going with the basic tier ($6.30/month), and it is working fine.
Then, you have to prepare/switch your Django application from the development to the production environment: it is not a complicated procedure, but in my opinion, it is the most delicate. It entails modifying the settings.py
file in the main project folder, linking Render's PostgreSQL database, downloading Uvicorn and Gunicorn, setting up the static file serving and creating a script to automate the deployment operations such as install the required packages or apply the necessary database migrations. Everything is clearly explained in the Render's deployment documentation.
Finally, you have to create your web service and deploy your project! Again, I have to say that I found Render simply amazing, especially regarding the setting up of the environmental variables: during the procedure, the platform offers a dedicated form that allows you to upload them directly from your .env
file. Anyway, once you have filled up all the required fields, the deployment begins as soon as you click on the Deploy Web Service. You can follow it live by clicking on:
If you have done everything correctly, after a couple of minutes, this string should appear:
==> Your service is live 🎉
Congratulations!
Now, what about the future? Well...I have already implemented the possibility to register, login, like, and comment on my posts, but the blog is obviously still in its "embryonal" stage: I look forward to implementing a profile page, a recovering password feature, improving the appearance with a sprinkle of CSS, and much more!
Keep following me: the journey continues...
(PS: This is an AI cruelty-free post, meaning that no AIs have been exploited to write it.)
Posted on: 14 Oct 2024, 10:49 a.m.
(Login to like/comment)
It's really cool Giulio! Nice job! 👌👌👌👌
Good job! Looking forward to see how this page develops!
Well done, bro!