File "D:\Python Development\Django_Broad\blog\blog\settings.py", line 19, in ALLOWED_HOSTS =config('ALLOWED_HOSTS', cast=csv()) TypeError: 'module' object is not callable
Why am I getting this error? someone help me..
csv as a module is not callable which means you cannot do csv()
, I don't know how config
works, but why do you not just use ALLOWED_HOSTS as from the Django documentation ?
locally you can just do:
ALLOWED_HOSTS = ['.localhost', '127.0.0.1', '[::1]']
After some research I found this code, which looks quite similar to yours and seems to resolve the problem that you have not right capitalization of Csv
:
from decouple import config, Csv
ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.