python简单制作网站(python 制作简单脚本)

时间: 2022-09-13 10:14:11 浏览次数:210

????????‘??ˉ?¢?é…????

1??python??‰è£…

  • ?????‘???è????‰è£… https://www.python.org
  • ?‰???? 3.10.4
  • ??ˉ?¢????é??é…????

?3???????é??-path ?·????:

D:\soft\python310\python.exe

D:\soft\python310\Scripts

  • VS Code????”1python解é????¨

2??Django??‰è£…

  • python -m pip install Django
  • ?‰???? 4.0.3

3??mysql??‰è£…

  • ???è????°??

https://dev.mysql.com/downloads/installer/

  • ?‰???? 8.0.28.0
  • ??ˉ??£ é??è?¤3306???è??é????‘????”¨?o?3308
  • root L@20220403
  • pip install mysqlclient
  • ??ˉ?¢????é??é…????

D:\soft\MySql8\MySQLServer 8.0\bin\

?·??????°?3???????é????-mysql.exe

?”1??omysql8.exe

  • ?????????

mysql8 -uroot -P 3308 -p L@20220403

  • ??¥???mysql??ˉ??|?-£?????ˉ??¨???

WIN+R services.msc

?o???Django????§?é…????

1???????oé?1???

  • ?????o

D:\soft\python310\Scripts\django-admin startproject devops

  • ??ˉ??¨

python manage.py runserver

  • è??é—?

http://127.0.0.1:8000/

2???????o?o”?”¨

  • ?????o????a?o”?”¨

python manage.py startapp at

3??é…????

  • settings.py
    • LANGUAGE_CODE = 'zh-hans'
    • INSTALLED_APPS????·???? 'at'
    • DATABASES

DATABASES = {

'default': {

'ENGINE': 'django.db.backends.mysql', # ??–è…????”¨ mysql.connector.django

'NAME': 'db_at',

'USER': 'root',

'PASSWORD': 'L@20220403',

'HOST': 'localhost',

'PORT': '3308',

}

}

    • TEMPLATES

'DIRS':

[os.path.join(BASE_DIR, 'templates')],

  • at/views.py

def hello(request):

context = {'hello': 'Hello World!'}

return render(request,

'hello.html', context)

  • ?????o?¨???? templates/at.html

<h1>{{ hello }}</h1>

  • at/urls.py

from django.urls import path

from . import views

urlpatterns = [

path(' ', views.hello, name='hello_name'),

]

  • urls.py

path('at/', include('at.urls')),

4???????o?¨????

  • ?o”?”¨/models.py
  • è???§??‘???¤

python manage.py makemigrations at

  • ????¤osql

python manage.py sqlmigrate at 0001

//sqlmigrate ?‘???¤??¥?”?????aè???§????????§°?????????è?”????ˉ1?o”???SQL

  • ?????oè?¨

python manage.py migrate

5???????o???????‘?è′|??·

  • ?????o?‘???¤

python manage.py createsuperuser

  • ???é??

http://127.0.0.1:8000/admin/ renjian01/123456a?

6????–???è§????

  • ?o”?”¨/views.py
    • ?·??????°?o”?”¨/urls.py

FAQ

??‘??vscode??¥é”????

Import "django.contrib" could not be

resolved from source

PylancereportMissingModuleSource)

pip list??¥?????ˉ??|??‰è£…?o????è???????-????′¢python.analysis.extraPaths???????·????é?1?·??????…è·ˉ??????

2??vscode??¥é”????

"include" is not definedPylance

reportUndefinedVariable

?·????

from django.urls import path, include


??‰??Jenkins

1?????è??

https://www.jenkins.io/download/

???è??war??…???windows??liunxé????ˉ??¥?”¨??admin/123456a?

2????¢?o?

??…????o?

https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

3??Jenkins ?μ??…¥??° Iframe

https://blog.csdn.net/github_39160845/article/details/108960606

4????‰è£…??’???

Blue Ocean

  非常感谢您读完蓝港网络的这篇文章:"python简单制作网站(python 制作简单脚本)",仅为提供更多信息供用户参考使用或为学习交流的方便。我们公司提供:网站建设、网站制作、官网建设、SEO优化、小程序制作等服务,欢迎联系我们提供您的需求。

标签: ?? in my

Copyright © 常州蓝港网络科技有限公司 苏ICP备2022017479号-1