Use Python to build Django application steps and Versioning conflict resolution _python

Source: Internet
Author: User

First you have to make sure that you have Python installed on your machine, and secondly, you have to make sure that you have Django installed on it.
Next, we can get into the first Django application
Very simple operation, that is, to enter the code at the Windows terminal:

Copy Code code as follows:

1 django-admin.py startproject MySite

Can be, such as: I am in the E:\Python33\python_workspace directory of my Computer to create a project
You set the catalogue yourself.
To run the command:
Copy Code code as follows:

django-admin.py Startproject MySite

#意思是创建一个以mysite命名的应用程序



The next step is to enter: E:\Python33\python_workspace\mysite directory
Note: Here must be advanced to the MySite directory, otherwise, will fail drop!!!!
To run the code:

Copy Code code as follows:

Python manage.py runserver 8080

#意思是启动服务, Port is: 8080, if the port is not set, the default is: 80000

The following figure:

Started the service, then we can now access through the browser
In the browser address bar, enter: http://localhost:8080

By now, your first Django application is a success!!!

Problems encountered and solutions:
1.importerror:no module named Django.core
Analysis and Solutions: This is the problem when you run the command: django-admin.py startproject MySite, and it's OK
The Django on your own machine has been successfully installed and can be passed:

Copy Code code as follows:

Python-c "Import Django;print (Django.get_version ())"

To verify, and secondly, the django-admin.py has been added to the environment variable:

Copy Code code as follows:

#加入到path环境变量中 #django的安装目录
E:\Python33\Lib\site-packages\django\bin

I did both of the above, but there was an error, and I found out the reason for the problem: there are too many Python versions installed on my computer: python2.7.5,python32,python33
Finally put the Python2.7.5,python32 uninstall, leaving only Python33, and then run, Success!!!
2.python:can ' t open file ' manage.py '
This is similar to the reason above, the solution, but also version of the conflict, the other uninstall off, leaving only PYTHON33, successful!!!

Related Article

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.