gpt4 book ai didi

python - ModuleNotFoundError : No module named 'DEGNet' while attempting >Python manage. py makemigrations|python 3.7,django 2.1.7

转载 作者:行者123 更新时间:2023-12-01 08:17:25 24 4
gpt4 key购买 nike

我正在使用 python-anywhere 制作 Web 应用程序,在尝试为新的 Profile 模型进行迁移时,出现错误:

> (pyshoptest-virtualenv) 20:23 ~/pyshop-test/pyshop (master)$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/core/management/__init__.py", line 224, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/core/management/__init__.py", line 36, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/core/management/commands/makemigrations.py", line 12, in <module>
from django.db.migrations.autodetector import MigrationAutodetector
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/db/migrations/autodetector.py", line 11, in <module>
from django.db.migrations.questioner import MigrationQuestioner
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/db/migrations/questioner.py", line 9, in <module>
from .loader import MigrationLoader
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/db/migrations/loader.py", line 8, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/db/migrations/recorder.py", line 9, in <module>
class MigrationRecorder:
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/db/migrations/recorder.py", line 22, in MigrationRecorder
class Migration(models.Model):
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/db/models/base.py", line 87, in __new__
app_config = apps.get_containing_app_config(module)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/apps/registry.py", line 249, in get_containing_app_config
self.check_apps_ready()
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/apps/registry.py", line 131, in check_apps_ready
settings.INSTALLED_APPS
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 57, in __getattr__
self._setup(name)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/site-packages/django/conf/__init__.py", line 107, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/home/bwc9876/.virtualenvs/pyshoptest-virtualenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'DEGNet'

我尝试查看 Settings.py 和其他类似的内容,但没有发现任何可能导致此错误的内容。

同时列出

Python manage.py help

我在帮助消息下方遇到错误,指出,

Note that only Django core commands are listed as settings are not properly configured (error: No module named 'DEGNet').

我的设置文件如下所示:

  ALLOWED_HOSTS = ['*myusername*.pythonanywhere.com']


# Application definition

INSTALLED_APPS = [
'users.apps.UsersConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'products.apps.ProductsConfig',
'crispy_forms'


]

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',
]

ROOT_URLCONF = 'pyshop.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, "templates")
],
'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 = '*myusername*_pythonanywhere_com_wsgi.py'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

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/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/home/*myusername*/*projectname*/static'

CRISPY_TEMPLATE_PACK = "bootstrap4"

LOGIN_REDIRECT_URL = "/products"

LOGIN_URL = 'login'

我的 WebApp 在当前模块中工作正常,但我就是无法让 makemigrations 工作

最佳答案

在您的 manage.py 文件中,更改 pythonanywhere 上的 DEGNet,它将起作用!祝你好运。

关于python - ModuleNotFoundError : No module named 'DEGNet' while attempting >Python manage. py makemigrations|python 3.7,django 2.1.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54897830/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com