Running these commands solved my problem (credit to this answer):
import django
django.setup()
However I’m not sure why I need this. Comments would be appreciated.
More Related Contents:
- Django CSRF check failing with an Ajax POST request
- Having Django serve downloadable files
- How can I enable CORS on Django REST Framework
- How do I include related model fields using Django Rest Framework?
- Why is using thread locals in Django bad?
- django.db.utils.OperationalError Could not connect to server
- Define css class in django Forms
- Custom ordering in Django
- How do I extend the Django Group model?
- When to use Serializer’s create() and ModelViewset’s perform_create()
- What is choice_set in this Django app tutorial?
- Django values_list vs values
- Django REST Framework serializer field required=false
- ValueError: Missing staticfiles manifest entry for ‘favicon.ico’
- Django: adding an “Add new” button for a ForeignKey in a ModelForm
- Python – Converting XLSX to PDF
- Why doesn’t django’s model.save() call full_clean()?
- Determine complete Django url configuration
- How do I prevent fixtures from conflicting with django post_save signal code?
- What’s the best solution for OpenID with Django? [closed]
- How can I get the current language in Django?
- How do i cast char to integer while querying in django ORM?
- Class Based Views VS Function Based Views
- QuerySet, Object has no attribute id – Django
- How to update manytomany field in Django?
- Django ‘AnonymousUser’ object has no attribute ‘_meta’
- Install mysqlclient for Django Python on Mac OS X Sierra
- How to get more diagnostic output on a “no module named xyz” error?
- Django admin: How to display the field marked as “editable=False” in the model?
- How to solve “Page not found (404)” error in Django?