python之自动化(django)

1、安装

我用的是pip install Django 在命令行中安装

然后django-admin startproject autotext(在命令行中)

这句话是创建一个django 项目

然后切换到你所创建项目的目录下

输入:

python manage.py runserver

当你出现以下错误时

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

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

输入:

python manage.py migrate

当你出现语言类错误输入:

set PYTHONIOENCODING=utf-8

出现以下东西证明你的django安装完成:

Watching for file changes with StatReloader

Performing system checks...

System check identified no issues (0 silenced).

March 13, 2024 - 18:41:38

然后你需要在命令行输入:

python manage.py createsuperuser

来创建一个最高权限的超级用户.

最后你可以使用浏览器来进入django

http://127.0.0.1:8000/admin(你的超级用户叫啥那么admin就换成啥就行)

后面的下次再讲反正不少。

相关推荐
用户83562907805110 小时前
无需 Office:Python 批量转换 PPT 为图片
后端·python
markfeng811 小时前
Python+Django+H5+MySQL项目搭建
python·django
GinoWi12 小时前
Chapter 2 - Python中的变量和简单的数据类型
python
JordanHaidee12 小时前
Python 中 `if x:` 到底在判断什么?
后端·python
ServBay12 小时前
10分钟彻底终结冗长代码,Python f-string 让你重获编程自由
后端·python
闲云一鹤13 小时前
Python 入门(二)- 使用 FastAPI 快速生成后端 API 接口
python·fastapi
Rockbean14 小时前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
曲幽14 小时前
FastAPI + Ollama 实战:搭一个能查天气的AI助手
python·ai·lora·torch·fastapi·web·model·ollama·weatherapi
用户606487671889615 小时前
国内开发者如何接入 Claude API?中转站方案实战指南(Python/Node.js 完整示例)
人工智能·python·api
只与明月听16 小时前
RAG深入学习之Chunk
前端·人工智能·python