PythonのDjangoにて、アプリを作っています。
#悩んでいること
models.pyを作ってmakemigrationsをしたところエラーが出ました。
Traceback (most recent call last): File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\urls\resolvers.py", line 590, in url_patterns iter(patterns) TypeError: 'module' object is not iterable 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\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line utility.execute() File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\management\__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\management\base.py", line 366, in execute self.check() File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\management\base.py", line 395, in check include_deployment_checks=include_deployment_checks, File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\management\base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\urls\resolvers.py", line 408, in check messages.extend(check_resolver(pattern)) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\urls\resolvers.py", line 407, in check for pattern in self.url_patterns: File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\utils\functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\Windows\Documents\pythonfiles\django\venv\tutorial\lib\site-packages\django\urls\resolvers.py", line 597, in url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'twitterdata.urls' from 'C:\Users\Windows\Documents\pythonfiles\django\venv\twitterproject\twitterdata\urls.py'>' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
modeles.pyのコードは下記です。
modeles.py
1from django.db import models 2 3# Create your models here. 4class TwitterModel(models.Model): 5 6 class Meta: 7 #テーブル名の指定 8 db_table ="category" 9 10 user_name = models.CharField(max_length=140) 11 user_id = models.CharField(max_length=140) 12 user_img = models.CharField(max_length=140) 13 user_text = models.TextField(null=True) 14 user_created_at = models.CharField(max_length=140)
#解決のために試したこと
コードを修正したりして、何度もmakemigrationsしてみたのですが、
同じエラーとなります。
OS、環境
Django 3.0.5
Python3.7.3
仮想環境:venv
調べているのですが、解決策が見つかりません。
お知恵お貸しいただけると助かります。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。