Before the installation and configuration, changed the computer, then installed and configured, and suddenly found that almost all forgotten, the record here is prepared after inspection.
- sudo apt-get install python-pip
- sudo apt-get install python-virtualenv # Installing the local Virtual Environment management tool
- mkdir ~/django # Create a directory
- CD ~/Django
- virtualenv venv # under the ~/django directory, create a venv virtual environment
- SOURCE Venv/bin/activate # Open Virtual Environment
- Pip install Django # using the PIP tool to install Django online
- mkdir ~/workplace # Create working directory
- CD ~/Workplace
- Django-admin.py startproject HelloWorld # Create a Django project
- CD ~/helloworld
The various files inside the Django creation project are described:
The following results are obtained under the project with the tree command:
Catalogue Description:
- HelloWorld: the container for the project.
- manage.py: a useful command-line tool that allows you to interact with the Django project in a variety of ways.
- helloworld/__init__.py: An empty file that tells Python that the directory is a python package.
- helloworld/settings.py: setup/configuration for this Django project.
- helloworld/urls.py: URL declaration for the Django project; A "directory" of Django-driven Web sites.
- helloworld/wsgi.py: a WSGI-compatible WEB server's portal to run your project.
Finally, enable the server:
Python manage.py runserver
Enter the URL of the prompt in the Linux browser and see the Web page, indicating success.
Additional notes:
PIP: is a tool to install the Python Index Pack (Pip is a-tool for installing Python packages from the Python package index)
Virtualenv: is a tool for creating a standalone Python environment (is a tools to create isolated Python environments)
(Usage scenario: Different projects require different versions, and different projects are developed or run on the same computer, which requires a separate virtual environment under each project).
Pip,virtulenv Related instructions: https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/
Ubuntu 16.04 Django Installation and configuration