Ubuntu 16.04 Django Installation and configuration

Source: Internet
Author: User
Tags install django pip install django virtual environment virtualenv

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.

  1. sudo apt-get install python-pip
  2. sudo apt-get install python-virtualenv # Installing the local Virtual Environment management tool
  3. mkdir ~/django # Create a directory
  4. CD ~/Django
  5. virtualenv venv # under the ~/django directory, create a venv virtual environment
  6. SOURCE Venv/bin/activate # Open Virtual Environment
  7. Pip install Django # using the PIP tool to install Django online
  8. mkdir ~/workplace # Create working directory
  9. CD ~/Workplace
  10. Django-admin.py startproject HelloWorld # Create a Django project
  11. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.