cool hit counter Build your first Django application_Intefrankly

Build your first Django application


First you need to make sure you have python installed on your machine:. Python development_python installation

Related learning materials for python.http://www.cnblogs.com/hongten/tag/python/

Secondly, you also need to make sure you have Django installed on it: the Hands-on installation of Django under Windows 7

The next step is to get to the Build your first Django application

It is very simple to do, i.e. enter the code in windows terminal.

1 django-admin.py startproject mysite

i.e. I am on my computer's E:Python33python_workspace directory under which to create the project's

You make the catalogs.

Run the command.

1 django-admin.py startproject mysite
2 
 3 # means create an application named after mysite

Moving on to.E:Python33python_workspacemysite table of contents

note Be sure to enter the mysite directory here, otherwise, it will fail to drop !!!!

Running code.

1  python manage.py runserver 8080
2 
 3 # means start the service on port: 8080,if you don't set the port, the default is: 8000

As shown below.

With the service started, then we can now access it through our browser

Type in the address bar of your browser: http://localhost:8080

By now, your first django application is considered a success!!!

Problems encountered and solutions

1.importError:No module named django.core

Analysis and solution: this is the problem encountered when running the command: django-admin.py startproject mysite, and it is certain that the

django is already successfully installed on your own machine and can be accessed via.

1 python -c "import django;print(django.get_version())"

to verify; second, django-admin.py has been added to the environment variables at

 1 #Add to path environment variable #django's installation directory
2 E:Python33Libsite-packagesdjangoin                 

I did both of the above steps, but I still got an error, then I found out the cause of the problem: I have too many versions of python installed on my computer: python2.7.5,python32,python33

Finally uninstalled python 2.7.5, python32, leaving only python33,and ran it again, success!!!

2.python:can't open file 'manage.py'

This one is similar to the cause above, the solution, also a version conflict, uninstall the others and leave only python33, success!!!

E | hongtenzone@foxmail.com B |http://www.cnblogs.com/hongten


Recommended>>
1、Ether swipe to pay blockchain in a Jordanian refugee camp
2、Issue 914 Resource Finder
3、The first thing you need to do is to get a good idea of what youre doing
4、Ebbinghaus Smart Education constructing an education information ecology and building a new future for education
5、Download the latest version of JDEObjectBrowser 13093

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号