On Aug 25, 10:26 pm, Dr00p <jvbyto...@gmail.com> wrote:
> Hi, I need to get Django to run in my code and I am having trouble.
> Every time I try to import my project (this is a seperate code I
> created to generate polls) it gives an import error and says
> DJANGO_SETTINGS_MODULE is not defined.
> I have tried multiple things like
> django.core.management.call_command('syncdb',
> 'settings=mysite.settings')
> django.core.management.call_command('syncdb', "pythonpath='/home/guest/
> Downloads/Site/Django/mysite'")
> But those give me the same error!
> I am trying to import mysite.polls but it won't let me.
> I have been trying to do it with out using manage.py because I don't
> know how to do it with manage.py
> If their is a way to use manage.py in my code I would but I personally
> can not figure it out.

Try to start your code with:

import settings
from django.core.management import setup_environ
setup_environ(settings)

> Any way you can help is great.
> If I am being to vague, I need to generate thousands of polls(even if
> you think this is stupid just ignore it), and to do that I created a
> script and I need to import my project but it will not allow me.
> I am in dire need of help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to