Tutorial for a First Project Using Django
Amjad Hossain takes us through creating his first project using Django. Let's see what happened!
Join the DZone community and get the full member experience.Join For Free
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.
Opinions expressed by DZone contributors are their own.