django-1.8

Not able to create super user with Django manage.py

Not able to create super user with Django manage.py Question: Trying to create a super user for my database: manage.py createsuperuser Getting a sad recursive message: Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser in your project to create one manually. Seriously Django? Seriously? The only information I …

Total answers: 9

Django app works fine, but getting a TEMPLATE_* warning message

Django app works fine, but getting a TEMPLATE_* warning message Question: When I use runserver, it gives this warning message: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG. Quoth the Django Documentation: …

Total answers: 5

Django runserver from Python script

Django runserver from Python script Question: The normal way to start the Django server is to run the following command from a terminal or a bash script: python manage.py runserver [Ip.addr]:[port] e.g. python manage.py runserver 0.0.0.0:8000 How can I start a Django server from a Python script? One option is the following import os if …

Total answers: 2

Django: durationField default value

Django: durationField default value Question: What’s the right way to use Django’s DurationField? When I use time_passed = models.DurationField(default=0): Migrations work Form defaults don’t work (‘int’ object has no attribute ‘total_seconds’) When I use time_passed = models.DurationField(default=timedelta()): Migrations don’t work (ValueError: Cannot serialize: datetime.timedelta(0)) Form defaults work So what is the right way to use …

Total answers: 2

What should I use instead of syncdb in Django 1.9?

What should I use instead of syncdb in Django 1.9? Question: Take a look at this: $ pypy ./manage.py syncdb /usr/lib64/pypy-2.4.0/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9 warnings.warn(“The syncdb command will be removed in Django 1.9”, RemovedInDjango19Warning) (cut) I ran a quick google search, but could not find the answer – …

Total answers: 4

"Models aren't loaded yet" error while populating in Django 1.8 or later

"Models aren't loaded yet" error while populating in Django 1.8 or later Question: I am using this code to populate my database: import os def populate(): python_cat = add_cat(‘Python’) add_page(cat=python_cat, title=”Official Python Tutorial”, url=”http://docs.python.org/2/tutorial/”) add_page(cat=python_cat, title=”How to Think like a Computer Scientist”, url=”http://www.greenteapress.com/thinkpython/”) add_page(cat=python_cat, title=”Learn Python in 10 minutes”, url=”http://www.korokithakis.net/tutorials/python/”) django_cat = add_cat(name=”Django”) add_page(cat=django_cat, title=”Official …

Total answers: 3