我的项目名称是宝洁,我已经把这个项目从我的电脑转移到笔记本电脑,因此我面临错误。
我几乎尽了一切努力来解决这个错误,但没有一个对我有用。
modules
我的python版本是3.10.7
错误:
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\core\servers\basehttp.py", line 47, in get_internal_wsgi_application
return import_string(app_path)
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\utils\module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\utils\module_loading.py", line 15, in cached_import
module = import_module(module_path)
File "D:\1.Coding Softwares\Python\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Dalvi\Desktop\Anish\Python Project\Online-Proctor-System\proctor\proctor\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
handler = self.get_handler(*args, **options)
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 31, in get_handler
handler = super().get_handler(*args, **options)
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\core\management\commands\runserver.py", line 78, in get_handler
return get_internal_wsgi_application()
File "C:\Users\Dalvi\Envs\proctor\lib\site-packages\django\core\servers\basehttp.py", line 49, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'proctor.wsgi.application' could not be loaded; Error importing module.
树
├───adminsite (app)
│ ├───migrations
│ │ └───__pycache__
│ └───__pycache__
├───logreg (app)
│ ├───migrations
│ │ └───__pycache__
│ └───__pycache__
├───proctor (project)
│ └───__pycache__
├───static
│ ├───css
│ │ ├───adminsite
│ │ ├───login
│ │ └───usersite
│ ├───images
│ │ └───adminsite
│ └───js
│ ├───adminsite
│ └───usersite
├───static_root
│ ├───admin
│ │ ├───css
│ │ │ └───vendor
│ │ │ └───select2
│ │ ├───fonts
│ │ ├───img
│ │ │ └───gis
│ │ └───js
│ │ ├───admin
│ │ └───vendor
│ │ ├───jquery
│ │ ├───select2
│ │ │ └───i18n
│ │ └───xregexp
│ ├───css
│ │ ├───adminsite
│ │ ├───login
│ │ └───usersite
│ ├───images
│ │ └───adminsite
│ ├───js
│ │ ├───adminsite
│ │ └───usersite
│ └───static_root
│ ├───admin
│ │ ├───css
│ │ │ └───vendor
│ │ │ └───select2
│ │ ├───fonts
│ │ ├───img
│ │ │ └───gis
│ │ └───js
│ │ ├───admin
│ │ └───vendor
│ │ ├───jquery
│ │ ├───select2
│ │ │ └───i18n
│ │ └───xregexp
│ ├───css
│ │ ├───adminsite
│ │ ├───login
│ │ └───usersite
│ ├───images
│ │ └───adminsite
│ └───js
│ ├───adminsite
│ └───usersite
├───templates
│ ├───adminsite
│ ├───logreg
│ └───usersite
└───usersite (app)
├───migrations
│ └───__pycache__
└───__pycache__
settings.py of project (proctor)
import os
from pathlib import Path
import proctor
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-!2eg$jgi04pesan7_)@^((#o)fq($9namjy&gii=mi0s@ko-+n'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
# logreg app
'logreg.apps.LogregConfig',
# crispy forms
'crispy_forms',
'adminsite.apps.AdminsiteConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'phonenumber_field',
'usersite',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_auto_logout.middleware.auto_logout',
]
ROOT_URLCONF = 'proctor.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates/usersite'),os.path.join(BASE_DIR, 'templates/logreg'),os.path.join(BASE_DIR, 'templates/adminsite')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'proctor.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME':'proctor',
'USER':'root',
'PASSWORD':'root',
'HOST':'127.0.0.1',
'PORT':'3306',
}
}
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
STATIC_ROOT =os.path.join(BASE_DIR, "static_root")
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
# Base url to serve media files
MEDIA_URL = '/media/'
# Path where media is stored
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
#AUTO_LOGOUT = {'IDLE_TIME': 200}
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
wsgi.py of project (proctor)
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proctor.settings')
application = get_wsgi_application()
发布于 2022-09-17 09:24:31
安装了Python的较低版本,即从3.10到3.7,然后安装了所有缺少的模块
pip install pymysql
python -m pip install Pillow
pip install cryptography
pip install django_auto_logout
pip install requests_html
https://stackoverflow.com/questions/73749550
复制相似问题