0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pycharmでdjangoのアプリを新規作成時に起こるエラー対処

Posted at

#pycharmでdjangが作成できなくなった
pycharmでnew projectからDjangoを選択し、app nameに記入してcreatすると

Error creating Django application: Error on Python side. Exit code: 1, err: 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\user\anaconda3\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\user\anaconda3\lib\site-packages\django\core\management\__init__.py", line 357, in execute
    django.setup()
  File "C:\Users\user\anaconda3\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\user\anaconda3\lib\site-packages\django\apps\registry.py", line 114, in populate

のようにエラーが出てしまい、terminalでrunserverを実行してもうまくいかない。
正直上記のエラーが何によるものかが未だよくわかっていないが、大変参考になるサイトから引用させてもらうと、

settings.pyのSTATIC_URLの下に以下の設定を追加。

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

この一文を加えることで、runserverコマンドも通るようになった
#参考サイト
https://www.simpletraveler.jp/2021/06/20/python-django-troubleshooting-collectstaatic-exited-with-exitcode-1/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?