diff --git a/reallibrary/settings.py b/reallibrary/settings.py index 34d4272..c348352 100644 --- a/reallibrary/settings.py +++ b/reallibrary/settings.py @@ -12,10 +12,11 @@ import os -from dotenv import load_dotenv + +#from dotenv import load_dotenv from pathlib import Path -load_dotenv() +#load_dotenv() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -45,6 +46,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + "web.apps.WebConfig", ] MIDDLEWARE = [ @@ -55,6 +57,7 @@ "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", + ] ROOT_URLCONF = "reallibrary.urls" @@ -84,11 +87,11 @@ DATABASES = { "default": { "ENGINE": "django.db.backends.mysql", - "NAME": os.environ.get("MYSQL_DATABASE"), - "HOST": os.environ.get("MYSQL_DATABASE_HOST"), - "PORT": os.environ.get("MYSQL_DATABASE_PORT"), - "USER": os.environ.get("MYSQL_USER"), - "PASSWORD": os.environ.get("MYSQL_PASSWORD"), + "NAME": 'FinalDemo', + "HOST": '127.0.0.1', + "PORT": '3306', + "USER": 'root', + "PASSWORD": 'liuyuyang', } } @@ -127,7 +130,12 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ -STATIC_URL = "static/" +STATIC_URL = '/static/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static'), +] + # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field diff --git a/reallibrary/urls.py b/reallibrary/urls.py index f41f3c3..2e5cc1f 100644 --- a/reallibrary/urls.py +++ b/reallibrary/urls.py @@ -16,9 +16,17 @@ from django.contrib import admin from django.urls import include, path +from web.views import index,logins,regist,log_out +from reallibrary import settings +from django.conf.urls.static import static + urlpatterns = [ path("events/", include("events.urls")), path("inventory/", include("inventory.urls")), path("rooms/", include("rooms.urls")), path("admin/", admin.site.urls), + path("",index,name='home_page'), + path("regist/",regist,name='regist_page'), + path("login/",logins,name="log_in_page"), + path("logout/",log_out) ] diff --git a/web/__init__.py b/web/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/web/admin.py b/web/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/web/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/web/apps.py b/web/apps.py new file mode 100644 index 0000000..c11daac --- /dev/null +++ b/web/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class WebConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "web" diff --git a/web/migrations/__init__.py b/web/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/web/models.py b/web/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/web/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/web/static/img/library.jpg b/web/static/img/library.jpg new file mode 100644 index 0000000..ad8ce6d Binary files /dev/null and b/web/static/img/library.jpg differ diff --git a/web/static/img/publications.png b/web/static/img/publications.png new file mode 100644 index 0000000..b804087 Binary files /dev/null and b/web/static/img/publications.png differ diff --git a/web/templates/index.html b/web/templates/index.html new file mode 100644 index 0000000..97639ab --- /dev/null +++ b/web/templates/index.html @@ -0,0 +1,68 @@ +{%load static%} + + + +
+ + + +
+