Ubuntu Deployment Django

Source: Internet
Author: User
Tags install django

Just installed Ubuntu, want to try Django, here is the procedure

1. Irrelevant, install SSH

sudo apt-get update

sudo apt-get install Openssh-server

/etc/init.d/ssh start

2. Then you can access it via X_shell, install Django

sudo apt-get install python-django-y

3. See the Django version

Python

Import Django

Django.get_version ()

Output 1.8.1

4, check the next file, CTRL + C can not exit, check the terminal into the Python command to use Ctrl+d exit

5, create a site, it is called HelloWorld Bar

mkdir MySite

CD MySite

Django-admin Startproject HelloWorld

6, into the site to view the next file

sudo apt install tree

Then you can use the tree without LS.

Tree when the file is displayed in the form of trees

7. Start the site

Python manage.py runserver an error,

Hint to first Python manage.py migrate

Well, first Python manage.py migrate.

And then Python manage.py runserver

8, OK, prompt to access the http://127.0.0.1:8000

CTRL + C to exit

9, open the browser to access the upper address, the page shows, "It worked!"

10, the virtual machine access is no problem, back to the host machine with IP access

To modify the startup mode:

Python manage.py runserver 0.0.0.0:8000

Access appears 500, prompting "need to add U ' virtual machine IP ' to Allowed_host"

Baidu, modify the project setting.py, the allowd_hosts =[] changed to allowd_hosts =[' * '

Re-visit, "It worked!"

Ubuntu Deployment Django

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.