Create Your Django Project The Right Way
As a Django developer with over two years of coding experience, I have seen and gotten a lot of messages from beginners asking me what is the right way of creating a Django project, After giving numerous answers I have decided to write a single blog post where I can reference beginners whenever I get such question, as you read further I will break down the process into multiple steps.
Creating A Virtual Environment
A lot of beginners don’t know what a virtual environment is so I will give you a short description of what a virtual environment is.
Steps For Creating Your First Virtual Environment
- Create Your Project Folder
c: mkdir project c: cd project
- Create And Activate Virtual Environment
c:\project: python -m venv env #powershell c:\project: env/scripts/activate #cmd c:\project: env\scripts\activate (env) c:\project:
Creating Your Django Project
- Install Django in your activated environment
(env) c:\project: pip install django
- Create your Django project
#take note of that period (env) c:\project: django-admin startproject Todo .
After the successful running of this command, you would notice some files in your folder those are the project files
- Create and register your app
(env) c:\project: py manage.py startapp appname
After creating your app make sure you register it in the settings.py
- Start your Django server
(env) c:\project: py manage.py runserver
after starting your server the below image is what you get in your browser
Securing Your Django Project
A lot of important secret data has been leaked online due to the expos of secret keys and other important credentials, we would go further by securing our Django project with Onboardbase to avoid our project’s secret keys from being exposed online.
Why Onboardbase 🤔 ?
Onboardbase allows you to focus on actually building, coding, and shipping amazing products while it handles security for you. it does this by managing app secrets and credentials securely.
Here is how you can secure your Django project with Onboardbase
Subscribe to our newsletter
The latest news, articles, features and resources of Onboardbase, sent to your inbox weekly