Open ryosuzaki opened 3 years ago
(hackathon21) C:\介護ハッカソン>python manage.py migrate Traceback (most recent call last): File "manage.py", line 23, in <module> main() File "manage.py", line 19, in main execute_from_command_line(sys.argv) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line utility.execute() File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\management\__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\management\base.py", line 361, in execute self.check() File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\management\base.py", line 387, in check all_issues = self._run_checks( File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\management\commands\migrate.py", line 64, in _run_checks issues = run_checks(tags=[Tags.database]) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\core\checks\database.py", line 10, in check_database_backends issues.extend(conn.validation.check(**kwargs)) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\mysql\validation.py", line 9, in check issues.extend(self._check_sql_mode(**kwargs)) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\mysql\validation.py", line 13, in _check_sql_mode with self.connection.cursor() as cursor: File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\base\base.py", line 256, in cursor return self._cursor() File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\base\base.py", line 233, in _cursor self.ensure_connection() File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\base\base.py", line 217, in ensure_connection self.connect() File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\base\base.py", line 197, in connect self.init_connection_state() File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\mysql\base.py", line 231, in init_connection_state if self.features.is_sql_auto_is_null_enabled: File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\utils\functional.py", line 80, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\mysql\features.py", line 82, in is_sql_auto_is_null_enabled cursor.execute('SELECT @@SQL_AUTO_IS_NULL') File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\utils.py", line 103, in execute sql = self.db.ops.last_executed_query(self.cursor, sql, params) File "C:\介護ハッカソン\hackathon21\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_query query = query.decode(errors='replace') AttributeError: 'str' object has no attribute 'decode'
マイグレーション中のエラー
下のサイトを基に直したら動いた
仮想環境上のDjango C:\介護ハッカソン\hackathon21\Lib\site-packages\django\db\backends\mysql
https://www.366service.com/jp/qa/4f52794e9447565661c6e7ec31ac3440
仮想環境に移動
仮想環境名\Scripts\activate
INSTALLED_APPS登録 https://tutorial.djangogirls.org/ja/django_models/?q= INSTALLED_APPSをどう書くか https://python.keicode.com/django/django-app-directory.php
superuser iwasaki hackathon cars1201023@gn.iwasaki.ac.jp
PHPならMySQL無料 Pythonは有料 Azure App Service on Linux を使用して Python アプリを作成する https://docs.microsoft.com/ja-jp/azure/app-service/quickstart-python?tabs=cmd&pivots=python-framework-django
Djangoデータベース操作 についてのまとめ https://qiita.com/okoppe8/items/66a8747cf179a538355b
$ python manage.py runserver
normal_user hackathon mariaDBにユーザー作成して権限付与 まだ全権限 https://www.dbonline.jp/mysql/user/index1.html https://qiita.com/UNKCHAN/items/953567086243baf29022 https://qiita.com/peijipe/items/87cbf51720ec3fa338a8