3 tips for Django Beginners
Tags: django, beginners, webdev
Published: 2021-01-25 14:57:05

Django has been a lot popular in backend web development. And if you are reading this article you are either starting your Django journey or maybe are trying to see for ways to improve it.
In this article, I will tell you the three things which will surely help you in your Django journey.
But first what is Django? To put it simply it is a web framework in python.
Now coming back to the 3 tips, let's get started with it :

(1) Use virtual environment
============================================================================================================

If you have seen some tutorials or guides you already know that the best practices are to use a virtual environment for your Django projects, some of the reasons for this are :
-   It helps in maintaining a clean work-space.
-   When at the end you make the requirements file, only the libraries related to your current project are listed rather than everything on your device.
-   If in any case, things go south your system is safe.
Now, how can you create a virtual environment? Let's see :
I personally use the library [_virtualenv_](https://pypi.org/project/virtualenv/) for this.

Setting up our virtual environment using virtualenv:

-  Let's install virtualenv first
```
pip install virtualenv
``` -  Now let's use this library to make a virtual environment 
```
virtualenv name-of-your-virtual-environment
```
And we have successfully created our virtual env ;)
> Note: Before creating a virtual environment make sure you are in the directory you want to set up your virtual environment in.

(2) Try to maintain a systematic order
============================================================================================================

This will also help you when you work together with other people. Try to separate out the apps. Let a single app do a particular functioning, rather than bombarding everything in a single app. For example: If you are making a simple blog app, put the user-related stuff such as user login, logout, profile, etc in a single app, and keep the blog CRUD operations in another app.
This will not only look clean but also, it will help you out while fixing bugs or adding some new functionality.
Also, it is a good practice to write comments in different parts of code so that it is more clear for the open-source world.


(3) Deploy your Projects
============================================================================================================

To showcase your projects it is essential that you deploy them, now if you haven't already heard about GitHub, do acquire the basics of git and GitHub and push your project code on GitHub so that everyone& anyone can check out your code, moreover, to deploy your project and show it's working live to others there are two services which I use and so will recommend :

• [Heroku](https://www.pythonanywhere.com/)
• [PythonAnywhere](https://dashboard.heroku.com/)

If you want to know more about how to publish your projects on these platforms, I will be writing about that in my next article or you can just follow these tutorials :

• [How to deploy your Django app on Heroku](https://devcenter.heroku.com/articles/deploying-python)
• [How to deploy your Django app on pythonanywhere](https://help.pythonanywhere.com/pages/DeployExistingDjangoProject/)


Do you have any tips of your own to give to other Django developers? Tell me in the comments!
Thank you for reading! I hope you found this article insightful.

In case you want to connect with me, follow the links below →
[LinkedIn](https://www.linkedin.com/in/friskycodeur/) | [Twitter](https://twitter.com/moodyarrow) | [Medium](https://medium.com/@friskycodeur) | [Github](https://github.com/friskycodeur)