Software Alternatives & Reviews

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

Flask Bottle
  1. 1
    a microframework for Python based on Werkzeug, Jinja 2 and good intentions.
    Pricing:
    • Open Source
    Import osdef 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 Django Tutorial", url="http://djangoproject.com/en/1.5/intro/tutorial01/") add_page(cat=django_cat, title="Django Rocks", url="http://www.djangorocks.com/") add_page(cat=django_cat, title="How to Tango with Django", url="htttp://www.tangowithdjango.com/") frame_cat = add_cat(name="Other Frameworks") add_page(cat=frame_cat, title="Bottle", url="http://bottlepy.org/docs/dev/") add_page(cat=frame_cat, title="Flask", url="http://flask.pocoo.org") # Print out what we have added to the user. for c in Category.objects.all(): for p in Page.objects.filter(category=c): print "- {0} - {1}".format(str(c), str(p))def add\_page(cat, title, url, views=0): p = Page.objects.get_or_create(category=cat, title=title, url=url, views=views)[0] return pdef add\_cat(name): c = Category.objects.get_or_create(name=name) return cif __name__ == '\_\_main\_\_': print "Starting Rango population script..." os.environ.setdefault('DJANGO\_SETTINGS\_MODULE', 'p.settings') from rango.models import Category, Page populate() On running.

    #Python Web Framework #Web Frameworks #Developer Tools 42 social mentions

  2. 2
    bottle.py is a fast and simple micro-framework for python web-applications.
    Import osdef 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 Django Tutorial", url="http://djangoproject.com/en/1.5/intro/tutorial01/") add_page(cat=django_cat, title="Django Rocks", url="http://www.djangorocks.com/") add_page(cat=django_cat, title="How to Tango with Django", url="htttp://www.tangowithdjango.com/") frame_cat = add_cat(name="Other Frameworks") add_page(cat=frame_cat, title="Bottle", url="http://bottlepy.org/docs/dev/") add_page(cat=frame_cat, title="Flask", url="http://flask.pocoo.org") # Print out what we have added to the user. for c in Category.objects.all(): for p in Page.objects.filter(category=c): print "- {0} - {1}".format(str(c), str(p))def add\_page(cat, title, url, views=0): p = Page.objects.get_or_create(category=cat, title=title, url=url, views=views)[0] return pdef add\_cat(name): c = Category.objects.get_or_create(name=name) return cif __name__ == '\_\_main\_\_': print "Starting Rango population script..." os.environ.setdefault('DJANGO\_SETTINGS\_MODULE', 'p.settings') from rango.models import Category, Page populate() On running.

    #Web Frameworks #Developer Tools #Python Web Framework 16 social mentions

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

Log in or Post with