Question

collectstatic during deployment generates an error message.

Posted October 1, 2021 72 views
DjangoDeployment

I try to deploy a wagtail dev project to digitalocean. Once I run the on the server the command:

python manage.py collectstatic –settings=mysite.settings.production

I get the following error message:

ALLOWEDHOSTS = os.environ.get(“DJANGOALLOWED_HOSTS”).split(“,”)
AttributeError: ‘NoneType’ object has no attribute 'split’

I follow a commands from the tutorial learnwagtail deploy to DO

I tried different type of combinations, with (’,’) and without as a split. combination of IP/*/ or without. I then tried on an empty wagtail project, the result is the same.

My intuition was that it wasn’t related to DO. Yet, google results show this happens mainly on DO, i.e. it happens during deployment.

I follow commands from the tutorial https://learnwagtail.com/launch-your-wagtail-website-digital-ocean-ubuntu-18/

I try to deploy an empty project, so only settings that are modified are in relation to deployment and digitalocean.

Any return/help would be highly appreciated.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

The error message is pretty clear and straightforward.

AttributeError: ‘NoneType’ object has no attribute 'split’

At the time os.environ.get runs to grab the variable, DJANGOALLOWED_HOSTS, there’s no value in it.

Therefore, running a .split() on a non-existent data is why Python is basically saying, ‘You’re trying to run a function on nothing`