zoukankan      html  css  js  c++  java
  • 创建django项目

    • wsgi -- Web Server Gateway Interface
      •   用来处理client端和server端之间的TCP连接、HTTP原始请求和响应格式
    • 创建项目的步骤
      • 安装django:
        •   pip3 install django
      • 创建project:
        •   django-admin startproject mysite
      • 创建app:
        •   python manage.py startapp app01
      • settings配置:
        •   TEMPLATES:
          •   'DIRS': [os.path.join(BASE_DIR, 'templates')]
        •        STATICFILES_DIRS:
          •   STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'statics'), )
          •       STATIC_URL = '/static/'  
        •   INSTALLED_APPS:
          •   加入'app01',然后再同步数据库
      • 生成同步数据库的脚本:
        •   python manage.py makemigrations
      • 同步数据库::
        •   python manage.py migrate
      • 设计代码:urls.py  views.py
      • 返回http响应:
        •   from django.shortcuts import HttpResponse
        •   return HttpResponse()
      • 使用模板:
        •   from django.shortcuts import render
        •   return render(req, "index.html")
      • 启动项目:
        •   python manage.py runserver  127.0.0.1:8090
    • STATIC_URL的使用说明
      • STATICFILES_DIRS路径的别名,在html页面中引用js、css时,路径要使用STATIC_URL
      • 例如:<script src="/static/Semantic-UI-CSS-master/semantic.min.js"></script>
  • 相关阅读:
    上架的问题
    moya rxswift的简单实用
    MySql的简单使用,所有的代码基于MAC
    H5测试区别与PC端测试关注点
    测试小结
    测试之找回密码
    转Web安全测试之XSS
    一个最简单的登录页面测试case
    web测试特别点
    关于web测试
  • 原文地址:https://www.cnblogs.com/dongmengze/p/9668939.html
Copyright © 2011-2022 走看看