Question

collectstatic during deployment generates an error message.

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:

ALLOWED_HOSTS = os.environ.get(“DJANGO_ALLOWED_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.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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`