Unable to load render_to_response module

2011-11-11 Thread Ganesh Kumar
Hi ,

I have tried to load render_to_response module. it's through error. I
have tried download and install the module
https://github.com/jgorset/django-shortcuts
installed sucessfully, But not load any one of  you help me guys.


dhana013 ~ $ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from django.shortcuts import render_to_response
---
ImportError   Traceback (most recent call last)

/home/dhana013/ in ()

/usr/lib/pymodules/python2.6/django/shortcuts/__init__.py in ()
  8 from django.http import HttpResponse, Http404
  9 from django.http import HttpResponseRedirect,
HttpResponsePermanentRedirect
---> 10 from django.db.models.manager import Manager
 11 from django.db.models.query import QuerySet
 12 from django.core import urlresolvers

/usr/lib/pymodules/python2.6/django/db/__init__.py in ()
  8 __all__ = ('backend', 'connection', 'DatabaseError', 'IntegrityError')
  9
---> 10 if not settings.DATABASE_ENGINE:
 11 settings.DATABASE_ENGINE = 'dummy'
 12

/usr/lib/pymodules/python2.6/django/utils/functional.pyc in
__getattr__(self, name)
267 def __getattr__(self, name):
268 if self._wrapped is None:
--> 269 self._setup()
270 if name == "__members__":
271 # Used to implement dir(obj)

dhana013 ~ $ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from django.shortcuts import render_to_response
---
ImportError   Traceback (most recent call last)

/home/dhana013/ in ()

/usr/lib/pymodules/python2.6/django/shortcuts/__init__.py in ()
  8 from django.http import HttpResponse, Http404
  9 from django.http import HttpResponseRedirect,
HttpResponsePermanentRedirect
---> 10 from django.db.models.manager import Manager
 11 from django.db.models.query import QuerySet
 12 from django.core import urlresolvers

/usr/lib/pymodules/python2.6/django/db/__init__.py in ()
  8 __all__ = ('backend', 'connection', 'DatabaseError', 'IntegrityError')
  9
---> 10 if not settings.DATABASE_ENGINE:
 11 settings.DATABASE_ENGINE = 'dummy'
 12

/usr/lib/pymodules/python2.6/django/utils/functional.pyc in
__getattr__(self, name)
267 def __getattr__(self, name):
268 if self._wrapped is None:
--> 269 self._setup()
270 if name == "__members__":
271 # Used to implement dir(obj)


/usr/lib/pymodules/python2.6/django/conf/__init__.pyc in _setup(self)
 36 # NOTE: This is arguably an EnvironmentError, but
that causes

 37 # problems with Python's interactive help.

---> 38 raise ImportError("Settings cannot be imported,
because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
 39
 40 self._wrapped = Settings(settings_module)

ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

In [2]:

/usr/lib/pymodules/python2.6/django/conf/__init__.pyc in _setup(self)
 36 # NOTE: This is arguably an EnvironmentError, but
that causes

 37 # problems with Python's interactive help.

---> 38 raise ImportError("Settings cannot be imported,
because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
 39
 40 self._wrapped = Settings(settings_module)

ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

In [2]:

-Ganesh.

Did I learn something today? If not, I wasted it.

-- 
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.



Django Gig

2011-11-11 Thread Mo Mughrabi
Hello fellows django developers,

I've been developing with django for sometime now, building a website for
almost 6 months now. Am at a late stages and am getting stuck in a lot of
things related mostly to CSS, JS and some advance Django challenges. Am
looking for a django developer who's interested to work on this project,

Am expecting it might drag for another month or two, am looking for a full
time developer to be entirely dedicated for helping me finish pending
issues and tasks related to the project. Developer must be strong in the
following


   - Django
   - HTML/XHTML
   - CSS
   - JQuery and Javascripting
   - RabbitMQ and Celery for Django
   - WebServices


Please email me back if you are interested and I could share more details,

Best regards,

-- 
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.



Re: Unable to load render_to_response module

2011-11-11 Thread Daniel Roseman
On Friday, 11 November 2011 13:49:08 UTC, Ganesh-Bugcy wrote:
>
> Hi ,
>
> I have tried to load render_to_response module. it's through error. I
> have tried download and install the module
> https://github.com/jgorset/django-shortcuts
> installed sucessfully, But not load any one of  you help me guys.
>
>
> dhana013 ~ $ ipython
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.10 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: from django.shortcuts import render_to_response
> ---
> ImportError   Traceback (most recent call last)
>
> 
>
> ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
>
> In [2]:
>
> -Ganesh.
>
> Did I learn something today? If not, I wasted it.
>

As has been pointed out to you before, 
`django.shortcuts.render_to_response` has nothing whatsoever to do with the 
django-shortcuts third-party package. It does not need to be installed 
separately.

The traceback which you quote shows you exactly what is wrong - you have 
not set the DJANGO_SETTINGS_MODULE environment variable. To avoid the need 
for this, start your shell with `./manage.py shell` rather than ipython 
directly.
--
DR.

 

-- 
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/-/ZDIT9_mUqlkJ.
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.



Re: Unable to load render_to_response module

2011-11-11 Thread Bowen
I get the same error about django settings Before, I know how to get it done 
under IDE ,but  for the thing under command line,cannot fix it. Under IDE , I 
just set the django module Settings to be project name plus settings.
Regards,Bowen

发自我的 iPhone

在 2011-11-11,21:49,Ganesh Kumar  写道:

> Hi ,
> 
> I have tried to load render_to_response module. it's through error. I
> have tried download and install the module
> https://github.com/jgorset/django-shortcuts
> installed sucessfully, But not load any one of  you help me guys.
> 
> 
> dhana013 ~ $ ipython
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.10 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object'. ?object also works, ?? prints more.
> 
> In [1]: from django.shortcuts import render_to_response
> ---
> ImportError   Traceback (most recent call last)
> 
> /home/dhana013/ in ()
> 
> /usr/lib/pymodules/python2.6/django/shortcuts/__init__.py in ()
>  8 from django.http import HttpResponse, Http404
>  9 from django.http import HttpResponseRedirect,
> HttpResponsePermanentRedirect
> ---> 10 from django.db.models.manager import Manager
> 11 from django.db.models.query import QuerySet
> 12 from django.core import urlresolvers
> 
> /usr/lib/pymodules/python2.6/django/db/__init__.py in ()
>  8 __all__ = ('backend', 'connection', 'DatabaseError', 'IntegrityError')
>  9
> ---> 10 if not settings.DATABASE_ENGINE:
> 11 settings.DATABASE_ENGINE = 'dummy'
> 12
> 
> /usr/lib/pymodules/python2.6/django/utils/functional.pyc in
> __getattr__(self, name)
>267 def __getattr__(self, name):
>268 if self._wrapped is None:
> --> 269 self._setup()
>270 if name == "__members__":
>271 # Used to implement dir(obj)
> 
> dhana013 ~ $ ipython
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.10 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object'. ?object also works, ?? prints more.
> 
> In [1]: from django.shortcuts import render_to_response
> ---
> ImportError   Traceback (most recent call last)
> 
> /home/dhana013/ in ()
> 
> /usr/lib/pymodules/python2.6/django/shortcuts/__init__.py in ()
>  8 from django.http import HttpResponse, Http404
>  9 from django.http import HttpResponseRedirect,
> HttpResponsePermanentRedirect
> ---> 10 from django.db.models.manager import Manager
> 11 from django.db.models.query import QuerySet
> 12 from django.core import urlresolvers
> 
> /usr/lib/pymodules/python2.6/django/db/__init__.py in ()
>  8 __all__ = ('backend', 'connection', 'DatabaseError', 'IntegrityError')
>  9
> ---> 10 if not settings.DATABASE_ENGINE:
> 11 settings.DATABASE_ENGINE = 'dummy'
> 12
> 
> /usr/lib/pymodules/python2.6/django/utils/functional.pyc in
> __getattr__(self, name)
>267 def __getattr__(self, name):
>268 if self._wrapped is None:
> --> 269 self._setup()
>270 if name == "__members__":
>271 # Used to implement dir(obj)
> 
> 
> /usr/lib/pymodules/python2.6/django/conf/__init__.pyc in _setup(self)
> 36 # NOTE: This is arguably an EnvironmentError, but
> that causes
> 
> 37 # problems with Python's interactive help.
> 
> ---> 38 raise ImportError("Settings cannot be imported,
> because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
> 39
> 40 self._wrapped = Settings(settings_module)
> 
> ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
> 
> In [2]:
> 
> /usr/lib/pymodules/python2.6/django/conf/__init__.pyc in _setup(self)
> 36 # NOTE: This is arguably an EnvironmentError, but
> that causes
> 
> 37 # problems with Python's interactive help.
> 
> ---> 38 raise ImportError("Settings cannot be imported,
> because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
> 39
> 40 self._wrapped = Settings(settings_module)
> 
> ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
> 
> In [2]:
> 
> -Ganesh.
> 
> Did I learn something today? If not, I wasted it.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" g

Serve a subset of uploaded media via Django

2011-11-11 Thread Nan
Hi folks --

I know a related topic has been addressed recently on this list, but
I've got a twist:

- Media uploaded by the staff via the admin interface needs to be
served quickly, with minimal load, directly via Apache / lighttpd /
nginx / whatever.  Ditto for fully-static media.

- Media uploaded by users needs to be protected and restricted to
access by that user -- i.e. served by Django.

I'd love to essentially have two different MEDIA_ROOT directories (one
in a place that the server can serve directly, one not), but don't
know how to make Django do that.

Is there any way to accomplish this without twisting myself in knots?
FWIW, this project is being hosted in multiple different server
environments, from nginx + apache/mod_wsgi to FCGI to lighttpd.

Thanks,
-Nan

-- 
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.



Re: Serve a subset of uploaded media via Django

2011-11-11 Thread Andre Terra
Hello, Nan

Please read through the File Uploads docs, especially the bit concerning
upload handlers[1]. Good luck!


Cheers,
AT

[1]
https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#upload-handlers


On Fri, Nov 11, 2011 at 2:30 PM, Nan  wrote:

> Hi folks --
>
> I know a related topic has been addressed recently on this list, but
> I've got a twist:
>
> - Media uploaded by the staff via the admin interface needs to be
> served quickly, with minimal load, directly via Apache / lighttpd /
> nginx / whatever.  Ditto for fully-static media.
>
> - Media uploaded by users needs to be protected and restricted to
> access by that user -- i.e. served by Django.
>
> I'd love to essentially have two different MEDIA_ROOT directories (one
> in a place that the server can serve directly, one not), but don't
> know how to make Django do that.
>
> Is there any way to accomplish this without twisting myself in knots?
> FWIW, this project is being hosted in multiple different server
> environments, from nginx + apache/mod_wsgi to FCGI to lighttpd.
>
> Thanks,
> -Nan
>
> --
> 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.
>
>

-- 
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.



Re: Serve a subset of uploaded media via Django

2011-11-11 Thread Nan

Thanks Andre -- that got me pointed in the right direction.  I think
that this solution[1] to upload outside of MEDIA_ROOT for a specific
field, plus this module[2] to abstract and offload as much of the file
serving effort as possible to the underlying server might do the
trick.  I'll post back if any other complications arise.

[1] 
http://stackoverflow.com/questions/1729051/django-upload-to-outside-of-media-root
[2] https://github.com/johnsensible/django-sendfile


On Nov 11, 11:38 am, Andre Terra  wrote:
> Hello, Nan
>
> Please read through the File Uploads docs, especially the bit concerning
> upload handlers[1]. Good luck!
>
> Cheers,
> AT
>
> [1]https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#uploa...
>
>
>
>
>
>
>
> On Fri, Nov 11, 2011 at 2:30 PM, Nan  wrote:
> > Hi folks --
>
> > I know a related topic has been addressed recently on this list, but
> > I've got a twist:
>
> > - Media uploaded by the staff via the admin interface needs to be
> > served quickly, with minimal load, directly via Apache / lighttpd /
> > nginx / whatever.  Ditto for fully-static media.
>
> > - Media uploaded by users needs to be protected and restricted to
> > access by that user -- i.e. served by Django.
>
> > I'd love to essentially have two different MEDIA_ROOT directories (one
> > in a place that the server can serve directly, one not), but don't
> > know how to make Django do that.
>
> > Is there any way to accomplish this without twisting myself in knots?
> > FWIW, this project is being hosted in multiple different server
> > environments, from nginx + apache/mod_wsgi to FCGI to lighttpd.
>
> > Thanks,
> > -Nan
>
> > --
> > 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.

-- 
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.



Re: Unable to load render_to_response module

2011-11-11 Thread 马博文
hi, Daniel:
   That does work, you solve a big problem for me. Thanks a lot.
   Also, it seems like manage.py have lots of built in command which are
doing different things. Could you give a thread that i can access to learn
more about those commands? thanks
By the way, i will tell people who have met the same problem the solution.
Thans again.
regards,
Bowen

在 2011年11月11日星期五,Daniel Roseman  写道:
> On Friday, 11 November 2011 13:49:08 UTC, Ganesh-Bugcy wrote:
>>
>> Hi ,
>>
>> I have tried to load render_to_response module. it's through error. I
>> have tried download and install the module
>> https://github.com/jgorset/django-shortcuts
>> installed sucessfully, But not load any one of  you help me guys.
>>
>> dhana013 ~ $ ipython
>> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 0.10 -- An enhanced Interactive Python.
>> ? -> Introduction and overview of IPython's features.
>> %quickref -> Quick reference.
>> help  -> Python's own help system.
>> object?   -> Details about 'object'. ?object also works, ?? prints more.
>>
>> In [1]: from django.shortcuts import render_to_response
>>
---
>> ImportError   Traceback (most recent call
last)
>>
>> 
>>
>> ImportError: Settings cannot be imported, because environment variable
>> DJANGO_SETTINGS_MODULE is undefined.
>>
>> In [2]:
>>
>> -Ganesh.
>>
>> Did I learn something today? If not, I wasted it.
>
> As has been pointed out to you before,
`django.shortcuts.render_to_response` has nothing whatsoever to do with the
django-shortcuts third-party package. It does not need to be installed
separately.
> The traceback which you quote shows you exactly what is wrong - you have
not set the DJANGO_SETTINGS_MODULE environment variable. To avoid the need
for this, start your shell with `./manage.py shell` rather than ipython
directly.
> --
> DR.
>
>
>
> --
> 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/-/ZDIT9_mUqlkJ.
> 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.
>

-- 
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.



ConditionalGetMiddleware question

2011-11-11 Thread K.C. Smith
Hi,

I'm interested in enabling this middleware module.  The Django doc.s
don't say much about this module.  From looking at the code, however,
and reading about these mechanisms it appears that the module will do
nothing unless the 'ETag' and/or the 'Last-Modified' properties are
already set on the response object.  Is that correct?

Thanks in advance.

K.C.



-- 
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.



Why does Django create Postgres timestamp columns with time zones?

2011-11-11 Thread Kevin
I thought that Django created datetime columns that were time zone 
agnostic, but when I looked at my Postgres table I saw that the values 
recorded there have time zone information.

Going further I found that the Postgres backend directs Django to create 
columns that use time zones.

>From django/db/backends/postgresql/creation.py:

data_types = {
...
'DateTimeField': 'timestamp with time zone',
...

The schema shows that the created column is specified as "timestamp with 
time zone".

CREATE TABLE notification_notice
(
  ...
  created timestamp with time zone NOT NULL,
  ...

The Postgres log shows the update statement that was sent. Django 
constructed a SQL statement that used UTC as the time zone as directed by 
my Django settings file.

UPDATE "notification_notice" SET "sender_id" = 1, "group_id" = NULL, 
"notice_type_id" = 1, "content_type_id" = 21, "object_id" = 3, "created" = 
E'2011-11-11 22:31:08.022148' WHERE "notification_notice"."id" = 14

This is what my table looks like. The created column has a timestame that 
has "-08" for its time zone. Postgres must be inspecting the time zone of 
my system clock to find the time zone.

my_db=# select * from notification_notice limit 1;
 id | sender_id | group_id | notice_type_id | content_type_id | 
object_id |   created| last_interaction_time 

+---+--++-+---+--+---
  1 |   |3 | 21 |  53 | 
6 | 2011-11-11 14:31:02.98882-08 | 
(1 row)

Questions:
Doesn't Django have a hands off policy to time zones?
Why does the Postgres backend use time zones for models.DateTimeField? Is 
this required by Postgres?
Is there a way to force Django to create timestamp columns in Postgres that 
don't use the time zone?

-- 
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/-/PS3TI8rGNugJ.
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.



Re: Django Gig

2011-11-11 Thread Russell Keith-Magee
On Fri, Nov 11, 2011 at 9:49 PM, Mo Mughrabi  wrote:
> Hello fellows django developers,
...
> Please email me back if you are interested and I could share more details,
> Best regards,

Hi Mo,

Two very important details that you might want to share:

 * Where is your company located?

 * Are you interested in applicants that want to telecommute?

Remember -- django-users is a mailing list with an international
audience. Just saying "Who wants a job" isn't very helpful unless you
are genuinely willing to hire anyone, anywhere.

Yours,
Russ Magee %-)

-- 
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.



Re: Unable to load render_to_response module

2011-11-11 Thread Ganesh Kumar
HI

Thanks Daniel it's working me. finally i understand third party
modules did not load bash, If you want load bash, you have set
DJANGO_SETTINGS_MODULE , other wise  start with your project directory

$ python manage.py shell
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from django.shortcuts import render_to_response

In [2]:

thanks guys.

-Ganesh.

Did I learn something today? If not, I wasted it.



On Fri, Nov 11, 2011 at 9:06 PM, Daniel Roseman  wrote:
> On Friday, 11 November 2011 13:49:08 UTC, Ganesh-Bugcy wrote:
>>
>> Hi ,
>>
>> I have tried to load render_to_response module. it's through error. I
>> have tried download and install the module
>> https://github.com/jgorset/django-shortcuts
>> installed sucessfully, But not load any one of  you help me guys.
>>
>> dhana013 ~ $ ipython
>> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 0.10 -- An enhanced Interactive Python.
>> ?         -> Introduction and overview of IPython's features.
>> %quickref -> Quick reference.
>> help      -> Python's own help system.
>> object?   -> Details about 'object'. ?object also works, ?? prints more.
>>
>> In [1]: from django.shortcuts import render_to_response
>>
>> ---
>> ImportError                               Traceback (most recent call
>> last)
>>
>> 
>>
>> ImportError: Settings cannot be imported, because environment variable
>> DJANGO_SETTINGS_MODULE is undefined.
>>
>> In [2]:
>>
>> -Ganesh.
>>
>> Did I learn something today? If not, I wasted it.
>
> As has been pointed out to you before, `django.shortcuts.render_to_response`
> has nothing whatsoever to do with the django-shortcuts third-party package.
> It does not need to be installed separately.
> The traceback which you quote shows you exactly what is wrong - you have not
> set the DJANGO_SETTINGS_MODULE environment variable. To avoid the need for
> this, start your shell with `./manage.py shell` rather than ipython
> directly.
> --
> DR.
>
>
>
> --
> 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/-/ZDIT9_mUqlkJ.
> 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.
>

-- 
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.



Re: Addng extra variable to request sent by self.client.get() when using django TestCase

2011-11-11 Thread nav
Thanks for telling me about TemplateResponse.

After experimenting for a while I have found that unless you call the
required URL through self.client.get() the templates variable is not
available whatever type of HttpResponse I use. In this case I am
calling the view directly because of the need to add something extra
to the request as mentioned before. The code is question looks like
this:

self.factory = RequestFactory()
request = self.factory.get('/')
request.subdomain = 'Something'
response = send_to_view(request, page=None)

response.render()

self.assertContains(response, 'SwanLotus | Something')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'something/something.html')

The two assertions above pass but self.assertTemplateUsed() still
gives an error:

template_names = [t.name for t in response.templates]
AttributeError: 'TemplateResponse' object has no attribute
'templates'.

Have you seen this happen in your experience? I am thinking of taking
a look at
the django source to see what client.get() does different.

Thanks,

Yours sincerely,
nav

On Nov 9, 4:14 pm, Flavia Missi  wrote:
> TemplateResponsehas
> the attributes you need, plus, the template rendering process is lazy.
> I always use this class instead of using HttpResponse directly.
>
> []'s
>
>
>
>
>
>
>
>
>
> On Wed, Nov 9, 2011 at 5:47 AM, nav  wrote:
> > Thanks RequestFactory does exactly what I needed it is a pity that I
> > had ignored it while going through the docs.
>
> > There is however one question I have is it possible to check what
> > template was used to render the content. The assertTemplateUsed()
> > method looks for a response.templates attribute that does not exist as
> > part of the response returned from the view. response.template (please
> > note the lack of the 's' at the end) is also a deprecated feature and
> > the django source says that response.templates should be used instead.
>
> > I cannot think of any other way to check what template was rendered
> > and wondered if you have any pointers in this respect.
>
> > Thanks once again.
>
> > Yours sincerely,
> > nav
>
> > On Nov 8, 8:39 pm, Flavia Missi  wrote:
> > > When I need something like you want, I usually use RequestFactory to
> > create
> > > the request and call the view directly.
>
> > > You can see an example herehttps://gist.github.com/1348085
>
> > > Hope that helps ;)
>
> > > []'s
>
> > > On Tue, Nov 8, 2011 at 12:21 PM, nav  wrote:
> > > > Dear Folks,
>
> > > > While testing my application I found out that the middleware that
> > > > implements process_request is not run. This is fine as long as I can
> > > > add the required field to the request object before passing the
> > > > required URL to self.client.get().
>
> > > > what I want to do is something like this
>
> > > > request.field = 'some value'
> > > > self.client.get(url)
> > > > assertsomething()
>
> > > > The variable field is checked for in the views and does some
> > > > processing based on that. What would be the best way to add this field
> > > > to the request sent by self.client.get().
>
> > > > Thanks,
>
> > > > Yours sincerely,
> > > > nav
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.> To post to this group, send 
> > > > email>todjango-us...@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.
>
> > > --
> > > Flávia Missi
> > > @flaviamissi 
> > > flaviamissi.com.brhttps://github.com/flaviamissi
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.> To post to this group, send email 
> > todjango-us...@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.
>
> --
> Flávia Missi
> @flaviamissi 
> flaviamissi.com.brhttps://github.com/flaviamissi

-- 
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.



Network configuration with django webpage

2011-11-11 Thread Ganesh Kumar
Hi guys,

I am new to django, I want to create a simple page to configure
network configuration,
to configure ip address and set submask and gateway configuration.

How to do with django, any clues and please guide me.

-Ganesh.
Did I learn something today? If not, I wasted it.

-- 
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.