質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

1回答

1053閲覧

dashをdjangoで利用しようとした際にエラー「ValueError: Empty module name」となる

dadabitti3271

総合スコア0

Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

0クリップ

投稿2022/11/16 14:58

前提

下記サイトを参考にしてdashをdjangoで動かそうとしているのですが、
「python manage.py migrate」を実行する際にエラーとなり、うまくいきません。

■参考サイト
https://akatak.hatenadiary.jp/entry/2020/07/25/161326

実現したいこと

・dashをdjangoで起動する
・上記djangoアプリをIISで起動する(予定)

発生している問題・エラーメッセージ

C:\python\djangomap\worldmap\worldmap.py:2: UserWarning: The dash_table package is deprecated. Please replace `import dash_table` with `from dash import dash_table` Also, if you're using any of the table format helpers (e.g. Group), replace `from dash_table.Format import Group` with `from dash.dash_table.Format import Group` C:\python\djangomap\worldmap\worldmap.py:3: UserWarning: The dash_core_components package is deprecated. Please replace `import dash_core_components as dcc` with `from dash import dcc` C:\python\djangomap\worldmap\worldmap.py:4: UserWarning: The dash_html_components package is deprecated. Please replace `import dash_html_components as html` with `from dash import html` Traceback (most recent call last): File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django_plotly_dash\finders.py", line 66, in __init__ module = importlib.import_module(module_name) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'dash_renderer' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line utility.execute() File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 398, in execute output = self.handle(*args, **options) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 89, in wrapped res = handle_func(*args, **kwargs) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\commands\migrate.py", line 75, in handle self.check(databases=[database]) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\management\base.py", line 419, in check all_issues = checks.run_checks( File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\contrib\staticfiles\checks.py", line 7, in check_finders for finder in get_finders(): File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\contrib\staticfiles\finders.py", line 281, in get_finders yield get_finder(finder_path) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django\contrib\staticfiles\finders.py", line 294, in get_finder return Finder() File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\site-packages\django_plotly_dash\finders.py", line 70, in __init__ module = importlib.import_module(module_name) File "C:\Users\dadab\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1011, in _gcd_import File "<frozen importlib._bootstrap>", line 950, in _sanity_check ValueError: Empty module name

該当のソースコード

settings.py

1""" 2Django settings for djangomap project. 3 4Generated by 'django-admin startproject' using Django 3.0.8. 5 6For more information on this file, see 7https://docs.djangoproject.com/en/3.0/topics/settings/ 8 9For the full list of settings and their values, see 10https://docs.djangoproject.com/en/3.0/ref/settings/ 11""" 12 13import os 14 15# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17TEMPLATE_DIR = os.path.join(BASE_DIR,'templates') 18 19# Quick-start development settings - unsuitable for production 20# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 21 22# SECURITY WARNING: keep the secret key used in production secret! 23SECRET_KEY = 'your-secret-key' 24 25# SECURITY WARNING: don't run with debug turned on in production! 26DEBUG = True 27 28ALLOWED_HOSTS = [] 29 30 31# Application definition 32 33INSTALLED_APPS = [ 34 'django.contrib.admin', 35 'django.contrib.auth', 36 'django.contrib.contenttypes', 37 'django.contrib.sessions', 38 'django.contrib.messages', 39 'django.contrib.staticfiles', 40 'django_plotly_dash.apps.DjangoPlotlyDashConfig', 41 'channels', 42 'channels_redis', 43 'bootstrap4', 44 'worldmap.apps.WorldmapConfig', 45] 46 47MIDDLEWARE = [ 48 'django.middleware.security.SecurityMiddleware', 49 'django.contrib.sessions.middleware.SessionMiddleware', 50 'django.middleware.common.CommonMiddleware', 51 'django.middleware.csrf.CsrfViewMiddleware', 52 'django.contrib.auth.middleware.AuthenticationMiddleware', 53 'django.contrib.messages.middleware.MessageMiddleware', 54 'django.middleware.clickjacking.XFrameOptionsMiddleware', 55] 56 57ROOT_URLCONF = 'djangomap.urls' 58 59TEMPLATES = [ 60 { 61 'BACKEND': 'django.template.backends.django.DjangoTemplates', 62 'DIRS': [TEMPLATE_DIR], 63 'APP_DIRS': True, 64 'OPTIONS': { 65 'context_processors': [ 66 'django.template.context_processors.debug', 67 'django.template.context_processors.request', 68 'django.contrib.auth.context_processors.auth', 69 'django.contrib.messages.context_processors.messages', 70 ], 71 }, 72 }, 73] 74 75WSGI_APPLICATION = 'djangomap.wsgi.application' 76 77 78# Database 79# https://docs.djangoproject.com/en/3.0/ref/settings/#databases 80 81DATABASES = { 82 'default': { 83 'ENGINE': 'django.db.backends.sqlite3', 84 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 85 } 86} 87 88 89# Password validation 90# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 91 92AUTH_PASSWORD_VALIDATORS = [ 93 { 94 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 95 }, 96 { 97 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 98 }, 99 { 100 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 101 }, 102 { 103 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 104 }, 105] 106 107 108# Internationalization 109# https://docs.djangoproject.com/en/3.0/topics/i18n/ 110 111LANGUAGE_CODE = 'en-us' 112 113TIME_ZONE = 'UTC' 114 115USE_I18N = True 116 117USE_L10N = True 118 119USE_TZ = True 120 121# Static files (CSS, JavaScript, Images) 122# https://docs.djangoproject.com/en/3.0/howto/static-files/ 123 124STATIC_URL = '/static/' 125 126 127### django_plotly_dashにて追加(ここから) ### 128 129ASGI_APPLICATION = 'djangomap.routing.application' 130 131CHANNEL_LAYERS = { 132 'default':{ 133 'BACKEND': 'channels_redis.core.RedisChannelLayer', 134 'CONFIG': { 135 'hosts':[('127.0.0.1', 6379),], 136 } 137 } 138} 139 140STATICFILES_FINDERS = [ 141 'django.contrib.staticfiles.finders.FileSystemFinder', 142 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 143 'django_plotly_dash.finders.DashAssetFinder', 144 'django_plotly_dash.finders.DashComponentFinder', 145] 146 147PLOTLY_COMPONENTS = [ 148 'dash_core_components', 149 'dash_html_components', 150 'dash_renderer', 151 'dpd_components', 152 'dpd_static_support', 153 'dash_bootstrap_components', 154] 155 156X_FRAME_OPTIONS = 'SAMEORIGIN' 157 158### django_plotly_dashにて追加(ここまで) ###

試したこと

「settings.py」の内容に不備がある可能性があると調べたら出てきたのでソースを確認しましたが、おかしいところが見当たりませんでした。

補足情報(FW/ツールのバージョンなど)

Python 3.8.7
Django 3.2.16
django-bootstrap4 22.2
django-plotly-dash 2.1.3
dash 2.6.2
dash-bootstrap-components 1.2.1
dash-core-components 2.0.0
dash-html-components 2.0.0

ここにより詳細な情報を記載してください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

Error

1値のエラー: モジュールの名前が空であり、名前空間上で参照できない。

投稿2022/11/16 16:54

atcoderyellow

総合スコア481

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

dadabitti3271

2022/11/17 02:30

ご教示いただきありがとうございます。 モジュールの値が空とあるのですが、そのような箇所が見当たらない状態です。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問