Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tutorial for a First Project Using Django

DZone's Guide to

Tutorial for a First Project Using Django

Amjad Hossain takes us through creating his first project using Django. Let's see what happened!

· Web Dev Zone ·
Free Resource

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

Install Python

Pip is python installation and dependency packages management tool.

Before installation anything, the best practice is for all time to keep updated ubuntu packages.

coder@rock:~/PycharmProjects$ sudo apt-get update

Now Install pip using the following command:

I got the message that pip is already installed on my machine but which is a lower version that I don’t want to use but the OS itself depends on it.

To install the latest version of pip we define the Python version with installation command.

Pip upgrade problem, cause OS is dependent on Python version 2.7.

Virtualenv is a tool for creating isolated Python environment.

Virtualenvwrapper is an extension of virtualenv tool for creating and deleting virtual environments and making it easier to work on more than one project at the same time without getting any conflicts in their dependencies.

Create a new directory to place virtual environment, the Python in new virtual environment is effectively isolated from the python that was used to create it.

The newly created virtual environment has activation script. To activate use the following command.

To deactivate the virtual environment use the deactivate command.

Install django in our virtual environment, this installation command is suggested from Django, if you are getting the following error, please remove -e option.

Please use the following command to install successfully.

We have to find manage.py to create new project. Please use the following command to find manage.py and create new project.


Create a superuser of your website.

Finally, run the following command to run the lightweight server.

Do copy the server started URL “http://127.0.0.1:8000/” and see congratulations.

You can also log in as admin by adding /admin into URL.

Now login using super admin user credentials then you will be able to see the admin dashboard.

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

Topics:
python ,django web development ,pip ,virtualenv

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}