Tuesday, August 28, 2012

Re: Problems with first tutorial

It didnt seem to work. All i get is the error:

C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: No module named user

Maybe i do it from the wrong directory, this is my buildtree:

Djangotest>testproject>testproject(have settings.py and everything created with djangoadmin),polls(have models, views and stuff),manage.py

If first tried to create the batch file in the first testproject folder, the one above where manage.py is. That didnt work.
I also tried to move it down to the next folder and it didnt work there either.
This is the batch file i wrote:

set TESTPROJECT_HOME=%CD%
set DJANGO_SETTINGS_MODULE=testproject.settings
set PYTHONPATH=%TESTPROJECT_HOME%

Any clue why it doesnt work?

On Tuesday, August 28, 2012 4:53:58 AM UTC+2, trebor63 wrote:

I hope this helps, when working under windows (XP/7) this just works for me.

Replace <project> with whatever you have named it.

From the directory above where the project was created create a batch file (ie <project>.bat) containing the following

set <project>_HOME=%CD%

set DJANGO_SETTINGS_MODULE=<project>.settings

set PYTHONPATH=%<project>_HOME%


You can add any other additional pythonpath requirements with the delimiter of a semicolon ';'

 

You could also hardcode the "<project>_HOME" variable, but this is up to you

 

Once done the following should work for you via the command prompt.

 

Run the batch file above from the directory it was created in

<project>

cd <project>

manage.py shell


On Tuesday, 28 August 2012 09:01:25 UTC+10, Snorre Edwin wrote:
Im on the Playing with the API part and seem to catch some troubles.
Everything has gone smoothly until this part.

I write this and get the next error. This is with my enviromen_variable: DJANGO_SETTINGS_MODULE set to where I can find the settings.py in my project.

C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: Could not import settings 'C:\Prosjekter\Djangotest\testproject\testproject' (Is it on sys.path?): Import by filename is not supported.

With out the env variable I get this error:
C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: No module named user

I have done the sync part and I can see that the postgreSQL have the tables in its database.
I have also done everything right until this part.

As i understood, I did not have to set env variable when I used python manage.py shell.

Can someone help me please:)

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

No comments:

Post a Comment