Post Detail

Django installation.

/static/assets/images/blog-detail.jpg

Share

Django installation

Create a virtual environment (this step is optional):

$ virtualenv env
Using base prefix '/usr/local/bin/../../../Library/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/rohanchadhury/django/env/bin/python
Installing setuptools, pip, wheel...
done.

In order to activate your virtual environment:

$ source env/bin/activate

Now install Django (all of the above can be skipped if you don't want to install django in virtual environment):

$ pip install django

Now we need to create a project. Let's say we are creating a blog website so we can name our project blog:

$ django-admin startproject blog

You should have the following files under your blog directory:

manage.py
blog/__init__.py
blog/asgi.py
blog/settings.py
blog/urls.py
blog/wsgi.py

To start the django website:

$ python manage.py runserver

By default the website can be accessed at http://127.0.0.1:8000/

Quick Links:

You may also like...