1
1

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.

Djangoでenviron利用時のエラーの対処法

Posted at

はじめに

Djangoでenvironモジュールを使用する際に

import environ


>raise ValueError, "No frame marked with %s." % fname
>                    ^
>SyntaxError: invalid syntax

上記のようなエラーが発生した時の対処法をまとめた

対処法

environではなくdjango-environモジュールを使う
ターミナルで下記コマンドを実行

pip3 install django-environ
sample.py
import environ

django-environをインストール前のソースコードの"import environ"は
そのままで問題ないです。

python3 manage.py runserver

このコマンドを実行すれば正常実行すると思います。

何回も出くわすのでメモ書き程度に

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?