Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Viewing all articles
Browse latest Browse all 9596

Tutorial for a First Project Using Django

$
0
0
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.


Tutorial for a First Project Using Django

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


Tutorial for a First Project Using Django
Pip upgrade problem, cause OS is dependent on Python version 2.7.
Tutorial for a First Project Using Django

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.


Tutorial for a First Project Using Django

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.


Tutorial for a First Project Using Django

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

To deactivate the virtual environment use the deactivate command.
Tutorial for a First Project Using Django

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


Tutorial for a First Project Using Django

Please use the following command to install successfully.


Tutorial for a First Project Using Django

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


Tutorial for a First Project Using Django

Create a superuser of your website.

Finally, run the following command to run the lightweight server.
Tutorial for a First Project Using Django
Tutorial for a First Project Using Django

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


Tutorial for a First Project Using Django

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


Tutorial for a First Project Using Django

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


Tutorial for a First Project Using Django

Viewing all articles
Browse latest Browse all 9596

Trending Articles