美文网首页
Django app 搭建第一步--helloworld

Django app 搭建第一步--helloworld

作者: Royal_KinM | 来源:发表于2017-07-06 20:27 被阅读42次

    这里用的是python 3.4 django 1.11.2版本,是在windows10环境下进行学习编译的。(之后可能会换成python 2.7)

    第一步,创建一个django项目

    django-admin startproject helloworld

    这里展示一下完整的初始项目目录

    helloworld

    ├── manage.py

    └── helloworld

        ├── __init__.py

        ├── settings.py

        ├── urls.py

        └── wsgi.py

    第二部,启动django的开发服务器

    进入helloworld项目根目录后,输入

    python manage.py runserver

    遇到以下问题:

    You have 13 unapplied migrations(s). Your project may not work properly untile you apply the migrations for app(s): admin, auth, contenttypes, sessions.

    Run 'python manage.py migrate' to apple them.

    ...

    在此有了现成的指示,然后输入

    python manage.py migrate

    有了如下输出

    Operationstoperform:  

    Apply all migrations: contenttypes, sessions, admin, authRunning migrations:  

    Applying contenttypes.0001_initial... OK  

    Applying auth.0001_initial... OK 

     Applying admin.0001_initial... OK  

    Applying sessions.0001_initial... OK

    ...

    然后再输入指令

    python manage.py runserver

    用浏览器登陆页面127.0.0.1:8000

    输出It Worked!

    初始运行完成。

    这里文字格式不太能调……这几天试试,能不能改的合适一些……

    相关文章

      网友评论

          本文标题:Django app 搭建第一步--helloworld

          本文链接:https://www.haomeiwen.com/subject/vurkhxtx.html