Tuesday, October 27, 2015

Re: Standalone Project using django ORM

The screen shot is attached. There is no error message but the trace. But the program seem stop at django.setup(). Though it ran smoothly in django 1.50

On Oct 28, 2015 12:27 AM, "Dheerendra Rathor" <dheeru.rathor14@gmail.com> wrote:
Is this the full stacktrace? Looks like error message is missing in stacktrace. 

On Wed, 28 Oct 2015 at 04:05 ADEWALE ADISA <solixzsystem@gmail.com> wrote:

Hello;
I have being having issues trying to use django orm in my application. This issues occur when using django 1.85. The application run perfectly well on django 1.50. Bellow are the snippet :

Model.py:
from django.db import models

class Person(models.Model):
    name = models.CharField(max_length=100)
    email = models.CharField(max_length=100)
    birthdate = models.DateField()
    class Meta:
        app_label = 'runnable'
   
    def __unicode__(self):
        return u'%d: %s' % (self.id, self.name)

app.py:

import sys
from os import path
import collections
import datetime
sys.path.insert(0, path.abspath(path.join(path.dirname(__file__), '..')))

from django.core.management import call_command
from django.conf import settings

#print(sys.path)
if not settings.configured:
    settings.configure(
       DEBUG=True,
        DATABASES={
            'default': {
                # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
                'ENGINE': 'django.db.backends.sqlite3',
                # Or path to database file if using sqlite3.
                'NAME': ':memory:',
            }
        },
        INSTALLED_APPS=("runnable", )
       
    )

import django
django.setup()
#call_command('syncdb')
call_command('makemigrations')
call_command('migrate')
call_command('inspectdb')
from models import Person
print("PERSON: "+ Person)

Console msg:
p.py", line 28, in <module>
    django.setup()
  File "/data/data/com.hipipal.qpy3/files/lib/python3.2/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/data/data/com.hipipal.qpy3/files/lib/python3.2/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/data/data/com.hipipal.qpy3/files/lib/python3.2/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/data/data/com.hipipal.qpy3/files/lib/python3.2/python32.zip/importlib/__init__.py", line 124, in import_module

Note:
The application run successfully with django 1.50  by uncomment syncdb and comment out migration, make migrations.

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMGzuy9BSMrgqw8uMgp3kd9eBu5fTdF4DCB9%3Di-8r6EmZmN-WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAByqUgjWYn%3DtfSeA-EBrzeur2_jodiPysZUS%3Dor%2BFeCFpKhbwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMGzuy_Qem4mFUqoz0E5m_-E9uGZEgRjeV%2B-07RTxNRrEi9bXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment