Binary file not shown.
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MyappConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'myapp'
|
||||
@ -0,0 +1,22 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-16 02:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='mod',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('user', models.CharField(max_length=255)),
|
||||
('password', models.IntegerField()),
|
||||
],
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-16 03:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('myapp', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='MyTable',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('field1', models.CharField(max_length=100)),
|
||||
('field2', models.IntegerField()),
|
||||
],
|
||||
options={
|
||||
'db_table': 'my_table',
|
||||
},
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-16 16:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('myapp', '0002_mytable'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Passenger',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100)),
|
||||
('account', models.CharField(max_length=100)),
|
||||
('password', models.CharField(max_length=100)),
|
||||
('mobileno', models.CharField(max_length=20)),
|
||||
('bankcardno', models.CharField(max_length=100)),
|
||||
('idcardno', models.CharField(max_length=100)),
|
||||
],
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='MyTable',
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-16 18:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('myapp', '0003_passenger_delete_mytable'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='passenger',
|
||||
name='account',
|
||||
field=models.CharField(max_length=100, null=True),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,38 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-16 18:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('myapp', '0004_alter_passenger_account'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='passenger',
|
||||
name='bankcardno',
|
||||
field=models.CharField(max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='passenger',
|
||||
name='idcardno',
|
||||
field=models.CharField(max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='passenger',
|
||||
name='mobileno',
|
||||
field=models.CharField(max_length=20, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='passenger',
|
||||
name='name',
|
||||
field=models.CharField(max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='passenger',
|
||||
name='password',
|
||||
field=models.CharField(max_length=100, null=True),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
from django.db import models
|
||||
|
||||
class mod(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
user= models.CharField(max_length=255)
|
||||
password= models.IntegerField()
|
||||
|
||||
# 数据输出样式
|
||||
def __str__(self):
|
||||
return f"['id': {self.id}, 'user': {self.user}, 'password': {self.password}]"
|
||||
|
||||
class Meta:
|
||||
db_table = 'us_pass'
|
||||
# 指定数据表名,可以是需要新建表的表名
|
||||
# 也可以是数据库中已存在的表
|
||||
# 但变量名需要和数据库中保持一致。
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
class Passenger(models.Model):
|
||||
name = models.CharField(max_length=100, null=True)
|
||||
account = models.CharField(max_length=100, null=True)
|
||||
password = models.CharField(max_length=100, null=True)
|
||||
mobileno = models.CharField(max_length=20, null=True)
|
||||
bankcardno = models.CharField(max_length=100, null=True)
|
||||
idcardno = models.CharField(max_length=100, null=True)
|
||||
# 添加更多字段...
|
||||
|
||||
# def __str__(self):
|
||||
# return self.name
|
||||
@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from django.http import HttpResponse
|
||||
|
||||
from TestModel.models import Test
|
||||
|
||||
# 数据库操作
|
||||
def testdb(request):
|
||||
test1 = Test(name='runoob')
|
||||
test1.save()
|
||||
return HttpResponse("<p>数据添加成功!</p>")
|
||||
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@ -0,0 +1,9 @@
|
||||
# passengers/urls.py
|
||||
from django.urls import path
|
||||
from . import views
|
||||
# from myapp.views import save_passenger
|
||||
|
||||
urlpatterns = [
|
||||
path('save-passenger/', views.save_passenger, name='save_passenger'),
|
||||
path('login/', views.login_view, name='login'),
|
||||
]
|
||||
@ -0,0 +1,2 @@
|
||||
import pymysql
|
||||
pymysql.install_as_MySQLdb()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for mysite project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
@ -0,0 +1,38 @@
|
||||
"""
|
||||
URL configuration for mysite project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/5.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path,include
|
||||
from django.contrib import admin
|
||||
from myapp import Login
|
||||
from myapp import views
|
||||
from myapp.views import save_passenger
|
||||
from myapp.views import login_view
|
||||
# from myapp.views import register_view
|
||||
app_name = 'myapp'
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
# path('validate_idcard/', Register.validate_idcard, name='validate_idcard'),
|
||||
# path('login/', Login.login, name='login'),
|
||||
path('save_passenger/', views.save_passenger, name='save_passenger'),
|
||||
path('login_view/', views.login_view, name='login_view'),
|
||||
# path('register_view/', views.register_view, name='register_view'),
|
||||
# path('', include('myapp.urls')),
|
||||
path('myapp/', include('myapp.urls')),
|
||||
]
|
||||
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for mysite project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
Loading…
Reference in new issue