How to create your Django project and modify its settings. (Part II)
In this tutorial, we are going to learn how to make a new Django project with the help of the Django framework we installed in the previous tutorial.
This is a part of our tutorial on Create Blog Website using Django
Link to Previous tutorial: Introduction to Django Framework and How to install it? (Part I)
Starting a Django Project – Python
We are now basically going to run some scripts provided by Django to create a project or specifically a bunch of files and directories which will make the outer skeleton of our Blog.
Move to the directory where you have your Virtual Environment folder and activate it using the command :
For Windows :
For Linux/ Mac OS :
Now, to finally create the Django Project, run the following commands in your Terminal/Shell.
For Windows :
django-admin.exe startproject site1 .
For Linux/Mac OS :
django-admin startproject site1 .
where ‘site1‘ is the name of the Project.
Keep in mind the ‘.’ mentioned in the above command which actually works as a short reference to the current working directory.
Now, you must have a folder with the name of the Project name itself. Similar to :
|----manage.py |----site1 | ---settings.py | ---urls.py | ---wsgi.py | ---__init__.py |----requirements.txt
along with your Virtual Environment directory in the same folder.
Changing Settings in Django
To change the Time and Language according to your own regional location.
Open Settings.py in it find the line containing
and change it accordingly. Then find the line containing
and change it to your language and country code.
You can take help from Wikipedia-List of time zones
Further to add path for Static files, at the end of the file; add
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
That’s it! Now you have finally created a Django Project and had a look at some of its settings.
Feel free to drop any query you face with the procedure in the comment section below.
Have a look at some other posts as well :