Re: Unable to storing unicode data using django

2013-04-12 Thread mln sastry
Hi Anshum,
  Thank you for responding.
  I defined a Book model as shown below and tried to save it from the admin
shell.
  I am using python2.7.3 , django1.5, and python mysql driver 1.2.3.
  I am not sure if my model data type is wrong or if any qualifier is
missing. Please help.

  I got this error:Warning: Incorrect string value:
'\xE0\xA4\xB6\xE0\xA5\x8D...' for column 'bookName' at row 1"

class *Book*(models.Model):

bookId = models.AutoField(primary_key=True)

bookName = models.TextField(max_length=200,null=False,)

bookShortName = models.CharField(max_length=10,null=True,)

isDeleted = models.NullBooleanField  (null=True,)



gita4 = Book(bookName= "श्रीमद्भगवद्गीता",bookShortName="गीता"
,isDeleted=False)

gita4.save()

Traceback (most recent call last):

  File "", line 1, in 

  File "C:\py\lib\site-packages\django\db\models\base.py", line 546, in save

force_update=force_update, update_fields=update_fields)

  File "C:\py\lib\site-packages\django\db\models\base.py", line 650, in
save_base

result = manager._insert([self], fields=fields, return_id=update_pk,
using=using, raw=raw)

  File "C:\py\lib\site-packages\django\db\models\manager.py", line 215, in
_insert

return insert_query(self.model, objs, fields, **kwargs)

  File "C:\py\lib\site-packages\django\db\models\query.py", line 1661, in
insert_query

return query.get_compiler(using=using).execute_sql(return_id)

  File "C:\py\lib\site-packages\django\db\models\sql\compiler.py", line
937, in execute_sql

cursor.execute(sql, params)

  File "C:\py\lib\site-packages\django\db\backends\util.py", line 41, in
execute

return self.cursor.execute(sql, params)

  File "C:\py\lib\site-packages\django\db\backends\mysql\base.py", line
120, in execute

return self.cursor.execute(query, args)

  File "C:\py\lib\site-packages\MySQLdb\cursors.py", line 204, in execute

if not self._defer_warnings: self._warning_check()

  File "C:\py\lib\site-packages\MySQLdb\cursors.py", line 117, in
_warning_check

warn(w[-1], self.Warning, 3)

Warning: Incorrect string value: '\xE0\xA4\xB6\xE0\xA5\x8D...' for column
'bookName' at row 1


On Fri, Apr 12, 2013 at 9:26 PM, Anshum Verma wrote:

>  Utf8 is default support in django unless you are explicitly typecasting
> to str. Please provide details of traceback and code snippets to debug this.
>
>
> Sent from my Windows Phone
>  --
> From: sastry mln 
> Sent: ‎12-‎04-‎2013 17:29
> To: django-users@googlegroups.com
> Subject: Unable to storing unicode data using django
>
> Hi All,
>   I have a mysqldb with utf8 charset and utf8_general_ci collation. The
> tables are also explicity defined to use the same charset/collation
>   I have a django model with CharField.
>   I want to store unicode characters (hindi language chars)
>   when i tested the model form django admin shell, I got error saying that
> the character is unrecognised.
>
>   I read the unicode section of the documenation, but i did not understand
> clearly.
>
>   can someone please post a snippet about how to let the web application
> allow unicode data entry using  (A) from django shell (b) From the data
> entry screen created through the modelAdmin forms
>
> regards
> mln
>
> --
> 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+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom view on the home page based on groups assigned to user.

2013-04-12 Thread Enator24


On Saturday, 13 April 2013 02:29:52 UTC+5:30, Enator24 wrote:
>
> Hi I need to develop an application where I have three groups first the 
> creator, second the reviewer, 3rd the Approver.
>
> I want that once the creator creates and submits the form for save, and 
> reviewer logs in at his end he should be able to view all the information 
> submieted and marked un-reviewed. it should be the same in case of 
> approver. 
>
> I want to use default django login , just want to customize the home ppage 
> that user would be able to see based on his group.
>
> Please advise , it is something like workflow app. I am stuck at this 
> point only.
>
> I have already looked into "request.user " approch but scene is different 
> here. i just want the custom home page based on group.
>
> Thanks ,
> Enator
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: One Way to Install Django on IIS

2013-04-12 Thread Mark Lybrand
Cool.Please provide feedback so we can make the steps better.  Already have
another friend encounter some issues trying to work our steps with his
config.  The more configs we put through the paces, the better this can be
:)
On Apr 12, 2013 4:18 PM, "Nick D"  wrote:

> Just what I'm going to need when I'm done with development.
>
> Thanks!
>
> On Friday, April 12, 2013 6:02:49 AM UTC-7, Mark Lybrand wrote:
>
>> My buddy and I were working last night on getting Django running on IIS7.
>>  We are not quite done as we are still working out issues surrounding
>> static files.  However, I thought these steps might be useful to others who
>> are struggling to get this working.
>>
>> Any thoughts or corrections welcome and appreciated:
>>
>> http://codesmartinc.com/2013/**04/12/running-django-in-**iis7iis8/
>>
>>
>>
>> --
>> Mark :)
>>
>  --
> 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+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Message processing queue for Django

2013-04-12 Thread John Riley
Hello Django users!

The latest cloud package (v2.7.7) from PiCloud (http://www.picloud.com)
gives Django users a distributed, fault-tolerant message queue with a
scalable message processing system. We ensure that you never lose any
messages, and that they're processed at the speed you need--even thousands
of messages per second.

More information:
Blog Post:
http://blog.picloud.com/2013/04/03/introducing-queues-creating-a-pipeline-in-the-cloud/
Documentation: http://docs.picloud.com/queue.html

What's it for?
Queues let you decouple your Django web application from the background
processing you need to do. Offloading heavy-duty work from your views is
desirable to keep your web app fast and responsive. Communication with your
Django app is done by simply pushing and popping messages.

Queues are perfect for integrating PiCloud into Django, or any realtime,
high-throughput system. If your workloads have been too short (< 1s) to use
our job system effectively, or you've found difficulty creating a
multi-stage pipeline with jobs, then you'll want to give queues a try!

Best Regards,
John

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




ViewDoesNotExist at /admin/

2013-04-12 Thread Daniel Guo
Hi all,
I've spent lot of time trying to figure out what is going on there, but my 
admin site is still not working.

I just followed the Django tutorial to create an app named polls. But I 
have a customized template_dir which is used by my previous app.

All the configurations to activate admin site are the same from official 
tutorial. But when I am trying to access the admin site: 
http://127.0.0.1:8000/admin/

I got the exceptions below:

Could not import django.views.generic.list_detail.object_list. Parent module 
django.views.generic.list_detail does not exist.

Request Method:GETRequest URL:http://127.0.0.1:8000/admin/Django Version:
1.5.1Exception Type:ViewDoesNotExistException Value:

Could not import django.views.generic.list_detail.object_list. Parent module 
django.views.generic.list_detail does not exist.

Exception 
Location:/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py 
in get_callable, line 104Python Executable:/usr/bin/pythonPython Version:
2.7.3Python Path:

['/home/daniel/Django-workspace/firstProject',
 '/usr/local/lib/python2.7/dist-packages/oauth2-1.5.211-py2.7.egg',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/gst-0.10',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/lib/python2.7/dist-packages/ubuntuone-client',
 '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
 '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
 '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']

Server time:Fri, 12 Apr 2013 20:12:16 -0500
 

Not like most of the similar issues from google. I found there is something 
wrong with the 'django.views.generic.list_detail does not exist'?? 
I am new to Django, could you please give me some hints to solve this?

Thanks a lot

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Newbie CSRF protection questions

2013-04-12 Thread testbackupacct
Russ,

This is a really great explanation of CSRF vulnerabilities, and I think I 
have a handle on what I need to do now.

Thanks for taking to time to spell things out for me.
>
>
Best,

Spork

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Reset Demo Database Data (with Dates)

2013-04-12 Thread Tom Evans
On Fri, Apr 12, 2013 at 8:00 PM, Joey Espinosa
 wrote:
>
> Hey guys,
>
> I have a situation where I have test data that has been entered into a
> demo database (MySQL). During the demo of the app with a customer, data will
> be altered. After the demo is complete, I need to "reset" the demo data back
> to what it was before the demo.
>
> I realize I could do this easily by dumping the database and then
> restoring it after the demo is complete, but there's a catch... the dates
> all need to change, too.
>
> So, say the demo happens on 05/01. I have an "Event" object with a date of
> "05/22" (21 days in the future). When the demo gets reset (I'm planning on a
> nightly reset, maybe 2am or something), it needs to change ALL the dates in
> the database to have the same "timedelta" to the next day. So on the next
> day, 05/02, that same "Event" object would have a date of "05/23" (still 21
> days in the future). This is necessary to keep things like date-based
> notifications, triggers, and other related things always in the same state
> whenever the demo occurs.
>
> I figure the steps would go something like this:
> 1) Dump database
> 2) // do demo
> 3) Restore database from dump
> 4) Some sort of django management command run on a cronjob to change all
> dates (or maybe straight SQL in a PROCEDURE or something).
>
> Any ideas on how to accomplish this?

Use traditional fixtures for any objects that are not date dependant.

https://docs.djangoproject.com/en/1.5/howto/initial-data/#providing-initial-data-with-fixtures

Use SQL fixtures for any objects that are date dependant, and specify
the date field in terms of "NOW() + INTERVAL 21 DAY" or similar.

https://docs.djangoproject.com/en/1.5/howto/initial-data/#providing-initial-sql-data

You can use the dumpdata command to create traditional fixtures, the
SQL ones you will need to craft by hand.

Cheers

Tom

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need Advice: Sending Emails

2013-04-12 Thread Venkatraman S
On Fri, Apr 12, 2013 at 10:51 PM, Kurtis Mullins
wrote:

> Check out sendgrid. If you use Rackspace I think they even give you a good
> discount.
>

Yes, they are called as "ESP" - Email  Service Provider. And I have thought
about them. Looks like this is the only way possible if i want to confirm
the 'deliverability' of the emails.



> You could also just configure everything to use Google's SMTP. I've done
> that for quite a few projects.
>

Looks like this is the easiest way out; but requires a google id(i.,e @
gmail.com) whereas you would like
emails to be sent from @yourdomain.com.

Another option would be to use Amazon SES.

Before i had started researching on this topic, i thought it was a 'normal
problem' to solve, as many would
have stumbled on this. Sending emails from both the app and from *nix
should be easy without requiring any heavyduty servers to be setupbut
sigh!

Venkat

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Reset Demo Database Data (with Dates)

2013-04-12 Thread Joey Espinosa
Nick,

Well, you're right, the interval would depend on how old the application
is. I'd rather do this through the ORM so that I can check each field to
see if it's the appropriate type (DateTimeField), since I don't know
exactly which fields I'll be working on (I know, it's pretty ridiculous). I
have to check the field type and increment if it's a date field.

--
Joey "JoeLinux" Espinosa
Python Developer
http://about.me/joelinux
On Apr 12, 2013 7:04 PM, "Nick D"  wrote:

> Joe,
>
> I'm new to Django but I do have some SQL experience. Couldn't you just run
> a statement similar to the following?
>
> update mytable
> set date1 = DATE_ADD(date1, INTERVAL 1 DAY)
>
> The pinch point here is the fact that you would have to update the
> interval based on how old the application is. That doesn't sound like fun!
> Can you give me a better idea of your data structure?
>
> On Friday, April 12, 2013 12:00:09 PM UTC-7, JoeLinux wrote:
>
>> Hey guys,
>>
>> I have a situation where I have test data that has been entered into a
>> demo database (MySQL). During the demo of the app with a customer, data
>> will be altered. After the demo is complete, I need to "reset" the demo
>> data back to what it was before the demo.
>>
>> I realize I could do this easily by dumping the database and then
>> restoring it after the demo is complete, but there's a catch... *the
>> dates all need to change, too.*
>>
>> So, say the demo happens on 05/01. I have an "Event" object with a date
>> of "05/22" (21 days in the future). When the demo gets reset (I'm planning
>> on a nightly reset, maybe 2am or something), it needs to change ALL the
>> dates in the database to have the same "timedelta" to the next day. So on
>> the next day, 05/02, that same "Event" object would have a date of "05/23"
>> (still 21 days in the future). This is necessary to keep things like
>> date-based notifications, triggers, and other related things always in the
>> same state whenever the demo occurs.
>>
>> I figure the steps would go something like this:
>> 1) Dump database
>> 2) // do demo
>> 3) Restore database from dump
>> 4) Some sort of django management command run on a cronjob to change all
>> dates (or maybe straight SQL in a PROCEDURE or something).
>>
>> Any ideas on how to accomplish this?
>> --
>> Joey "JoeLinux" Espinosa*
>> *
>> 
>>
>  --
> 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+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Building table headers based on instance of model

2013-04-12 Thread Tom Evans
On Fri, Apr 12, 2013 at 11:57 PM, Nick D  wrote:
> Hi again!
>
> I'm looking to create a table based on a model. I'm trying to make it simple
> and reusable. I want to build the table headers () based on the fields
> in the model. Given a specific model, is there a way to dynamically build
> the headers in the template?
>
> Thanks!
>

I'd doubt it, using standard template tags. However, you can do
whatever you want in the view, or in a custom template tag, in order
to extract and return the field names in a list that you can iterate
over.

Whether the work is done in the view or in a template tag, the concept
is the same, examine either ModelClassName._meta.fields or
instance._meta.fields (they are equivalent), perhaps filtering it.
This will give you a list of fields to iterate over.

Presumably you will also want to output the values in the rows below
as well, in which case you simply iterate through the field names
again. You'll need another custom template tag to dynamically extract
a field from an instance based upon a template variable, fortunately
this is a much more common idiom, see this example:

http://djangosnippets.org/snippets/411/

Everything you wanted to know about custom template tags is here:

https://docs.djangoproject.com/en/1.5/howto/custom-template-tags/

Cheers

Tom

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: One Way to Install Django on IIS

2013-04-12 Thread Nick D
Just what I'm going to need when I'm done with development.
 
Thanks!

On Friday, April 12, 2013 6:02:49 AM UTC-7, Mark Lybrand wrote:

> My buddy and I were working last night on getting Django running on IIS7. 
>  We are not quite done as we are still working out issues surrounding 
> static files.  However, I thought these steps might be useful to others who 
> are struggling to get this working.
>
> Any thoughts or corrections welcome and appreciated:
>
> http://codesmartinc.com/2013/04/12/running-django-in-iis7iis8/
>
>
>
> -- 
> Mark :) 
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-admin.py startproject mysite

2013-04-12 Thread Nick D
It looks like the path to django-admin.py is not in your system path.
 
You can try using the absolute path. ie: 
/usr/lb/python2.7/dist-packages/django/bin/django-admin.py startproject 
mysite
 
The tutorial also gives the following advice:
 
“command not found: django-admin.py”

*django-admin.py* 
should be on your 
system path if you installed Django via 
python setup.py. If it’s not on your path, you can find it in 
site-packages/django/bin, where site-packages is a directory within your 
Python installation. Consider symlinking to 
*django-admin.py*from 
some place on your path, such as
/usr/local/bin.


On Friday, April 12, 2013 10:34:11 AM UTC-7, Kevin Le Bouthillier wrote:

> django-admin.py startproject mysite
>
>
> unrecognized command. Why is the python+django setup instructions so unclear? 
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Reset Demo Database Data (with Dates)

2013-04-12 Thread Nick D
Joe,
 
I'm new to Django but I do have some SQL experience. Couldn't you just run 
a statement similar to the following?
 
update mytable
set date1 = DATE_ADD(date1, INTERVAL 1 DAY)
 
The pinch point here is the fact that you would have to update the interval 
based on how old the application is. That doesn't sound like fun! Can you 
give me a better idea of your data structure?

On Friday, April 12, 2013 12:00:09 PM UTC-7, JoeLinux wrote:

> Hey guys,
>
> I have a situation where I have test data that has been entered into a 
> demo database (MySQL). During the demo of the app with a customer, data 
> will be altered. After the demo is complete, I need to "reset" the demo 
> data back to what it was before the demo.
>
> I realize I could do this easily by dumping the database and then 
> restoring it after the demo is complete, but there's a catch... *the 
> dates all need to change, too.*
>
> So, say the demo happens on 05/01. I have an "Event" object with a date of 
> "05/22" (21 days in the future). When the demo gets reset (I'm planning on 
> a nightly reset, maybe 2am or something), it needs to change ALL the dates 
> in the database to have the same "timedelta" to the next day. So on the 
> next day, 05/02, that same "Event" object would have a date of "05/23" 
> (still 21 days in the future). This is necessary to keep things like 
> date-based notifications, triggers, and other related things always in the 
> same state whenever the demo occurs.
>
> I figure the steps would go something like this:
> 1) Dump database
> 2) // do demo
> 3) Restore database from dump
> 4) Some sort of django management command run on a cronjob to change all 
> dates (or maybe straight SQL in a PROCEDURE or something).
>
> Any ideas on how to accomplish this?
> --
> Joey "JoeLinux" Espinosa*
> *
>  
> 
>  

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Building table headers based on instance of model

2013-04-12 Thread Nick D
Hi again!
 
I'm looking to create a table based on a model. I'm trying to make it 
simple and reusable. I want to build the table headers () based on the 
fields in the model. Given a specific model, is there a way to dynamically 
build the headers in the template?
 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




need help with csv export

2013-04-12 Thread frocco
Hello,

I have a php export file that I need to duplicate in django.
I am using django csv import

Here is the PHP format I want.
3128559,"GOODYEAR","4024064","","","","","","","","","","","16","","","","",""

Here is the django output
3128559,'GENERAL','15480',,,'4'

I want it to look like the PHP version.

Here is my brief django code:

with open('D11238135.csv', 'w') as writer:

   line1 = '3128559'
line2 = "'" + manufacturer + "'"
line3 = "'" + row.sku + "'"
line4 = ''
line5 = ''
line6 = ''
line7 = ''
line8 = ''
line9 = ''
line10 = ''
line11 = ''
line12 = ''
line13 = ''
line14 = "'" + str(row.stock) + "'"
line15 = ''
line16 = ''
line17 = ''
line18 = ''

writer.writerow([line1, line2, line3, line4, line5, line6, 
line7, line8, line9, line10, line11,
 line12, line13, line14, line15, line16, 
line17, line18])

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Custom view on the home page based on groups assigned to user.

2013-04-12 Thread Anurag Chourasia
Within the templates, you can show different HTML elements based on the
user attributes/group. Traditional IF checks.

Regards,
Guddu

On Fri, Apr 12, 2013 at 4:59 PM, Enator24  wrote:

> Hi I need to develop an application where I have three groups first the
> creator, second the reviewer, 3rd the Approver.
>
> I want that once the creator creates and submits the form for save, and
> reviewer logs in at his end he should be able to view all the information
> submieted and marked un-reviewed. it should be the same in case of
> approver.
>
> I want to use default django login , just want to customize the home ppage
> that user would be able to see based on his group.
>
> Please advise , it is something like workflow app. I am stuck at this
> point only.
>
> I have already looked into "request.user " approch but scene is different
> here. i just want the custom home page based on group.
>
> Thanks ,
> Enator
>
> --
> 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+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Custom view on the home page based on groups assigned to user.

2013-04-12 Thread Enator24
Hi I need to develop an application where I have three groups first the 
creator, second the reviewer, 3rd the Approver.

I want that once the creator creates and submits the form for save, and 
reviewer logs in at his end he should be able to view all the information 
submieted and marked un-reviewed. it should be the same in case of 
approver. 

I want to use default django login , just want to customize the home ppage 
that user would be able to see based on his group.

Please advise , it is something like workflow app. I am stuck at this point 
only.

I have already looked into "request.user " approch but scene is different 
here. i just want the custom home page based on group.

Thanks ,
Enator

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Status of Django with Python 3.x

2013-04-12 Thread Mark Sundstrom
FWIW, I have several small, public-facing Django projects, all of which are 
on Django 1.5.1/Python 3.3. I've had no trouble with them at all. 

I've wanted to switch to Python 3 for a while, but it's only been in the 
past year (thanks in large part to Django's move) that it's become 
practical. 

All my work now is in 3.3; I'm not trying to stay compatible with 2.7+. If 
a package doesn't work with 3.3, then I'm not using it (or maybe, I would 
assist with porting it.) But I realize that's not practical for everybody.

All this is to say you should have no worries about using Django with 3.3

--Mark

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: should we develop apps based on urls?

2013-04-12 Thread Sam Solomon
Yes, it's okay to just try stuff out locally, but one word of caution, 
after everything is working and before you deploy the code, it's probably a 
good idea to review any "lets see how this looks/works" code/decisions to 
make sure it still makes sense.

Once a URL is in the wild, it's annoying to change because you have to 
decide if you need to redirect from the old urls to somewhere and if you do 
you have to figure out if it should be permanent and where you want it to 
redirect to and then implement the redirect.

Considerations for if you need a redirect:

   - Could someone be looking at a page that has a link while you are 
   deploying the code and then the link will take them to a 404?
   - Is it in a search engine somewhere that will then be used by a user to 
   try to reach your site?

Sam

On Wednesday, April 10, 2013 11:41:28 PM UTC-7, Mulianto wrote:
>
> Hi
>
> In django you can change the public URL with out change the function call 
> in the view.py
>
> The URL.py is flexible and can be just inside each app you create for 
> reusable .
>
> Mulianto
>
> Sent from my iPhone
>
> On 11 Apr 2013, at 13:11, surya > wrote:
>
> I have an unstructured idea in my to implement (say a weekend hack).
>
> The thing here is, how to give it a structure.. 
>
> 1. should I first define URLs and then divide apps based on it?
> 2. or something else.
>
> I want to develop a ratings site.. where people rate on product X.. 
>
> I like to divide apps in this way
>
> pages (have static pages if at all present)
> submissions (stores products, and ratings)
> persons (user accounts etc..)
>
> etc.. 
>
> any suggestions.
>
> Its like I am spending more time on designing things than writing code. 
> why is that happening and how to fix it.
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Reset Demo Database Data (with Dates)

2013-04-12 Thread Joey Espinosa
Hey guys,

I have a situation where I have test data that has been entered into a demo
database (MySQL). During the demo of the app with a customer, data will be
altered. After the demo is complete, I need to "reset" the demo data back
to what it was before the demo.

I realize I could do this easily by dumping the database and then restoring
it after the demo is complete, but there's a catch... *the dates all need
to change, too.*

So, say the demo happens on 05/01. I have an "Event" object with a date of
"05/22" (21 days in the future). When the demo gets reset (I'm planning on
a nightly reset, maybe 2am or something), it needs to change ALL the dates
in the database to have the same "timedelta" to the next day. So on the
next day, 05/02, that same "Event" object would have a date of "05/23"
(still 21 days in the future). This is necessary to keep things like
date-based notifications, triggers, and other related things always in the
same state whenever the demo occurs.

I figure the steps would go something like this:
1) Dump database
2) // do demo
3) Restore database from dump
4) Some sort of django management command run on a cronjob to change all
dates (or maybe straight SQL in a PROCEDURE or something).

Any ideas on how to accomplish this?
--
Joey "JoeLinux" Espinosa*
*



-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Date from DateTimeField vs date from model method: foreign key DateTimeField

2013-04-12 Thread Mike Doroshenko II
In my attached models.py I have a class that has a model method to 
return the time last modified on the latest object that has a foreign 
key to it.


So when I made a new document, in the admin interface I see April 11, 
2013, 8:24 p.m. for the Created column and 2013-04-11 20:24:36.799167 
for the Last Modified column.


Also I can click to sort the results by Created date, but not by last 
modified date.


How can I sanitize the Last Modified field so that it appears like 
Created does and I can sort by it?


Additionally in the same file in the model method I am using a for-loop 
to get the value for Last Modified. I imagine going through each object 
just to pull the data from the last one isn't very efficient and pretty 
redundant. I tried to just pull the last object directly but am getting 
an error:



 TemplateSyntaxError at /admin/grace/document/

Caught IndexError while rendering: list index out of range


--
Mike Doroshenko, Junior Sys Admin
TecKnoQuest Inc.
mi...@tecknoquest.com
www.tecknoquest.com

--
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


from django.db import models
import datetime

class Document(models.Model):
name = models.CharField(max_length=22)
created = models.DateTimeField(auto_now_add=True)

def __unicode__(self):
	return self.name

def last_modified(self):
	for m in self.piece_set.all():
	global x
	x = m.last_modified
	date = x
	#obj = self.piece_set.order_by("-id")[0]
	#date = obj.last_modified
	# Causes IndexError when rendering template in admin interface.
	return date

class Piece(models.Model):
sort_int = models.IntegerField()
doc = models.ForeignKey(Document)
text = models.TextField()
last_modified = models.DateTimeField(auto_now=True)

def __unicode__(self):
	return "%s:   %d" % (self.doc.name, self.sort_int)


Re: facebook/twitter sharing, and testing

2013-04-12 Thread sara ismail
didnt reallt get it, but thank u!


On Wed, Apr 10, 2013 at 11:26 PM, Bill Freeman  wrote:

>
>
>
> On Wed, Apr 10, 2013 at 11:55 AM, sara ismail 
> wrote:
>
>> can anyone help me?!
>>
>> On Wednesday, April 10, 2013 4:50:51 PM UTC+2, sara ismail wrote:
>>>
>>> im new to django, and i am working on a project, a selling and buying
>>> website, where a user can post about a product that he/she wants to sell,
>>> and my part right now is sharing posts from the site with facebook, and
>>> twitter. i was wondering how to test such a thing, like unit testing,
>>> knowing that i implemented front end only, just an HTML file.
>>> and i have another question, how can i take a post url, and make it the
>>> link to be shared with facebook/twitter, for example, a facebook/twitter
>>> share button is located under or next to each post, and each button when
>>> pressed on, redirects to fb sharing, and has that specific post's link
>>> appearing. how to do that?
>>>
>>> check the attached image, instead of facebook dialogs and the flowers
>>> img, i wasnt the post link, and probably an img too.
>>>
>>> thanks in advance!
>>
>>  I see three possibilities:
>
> 1. Test by posting to dummy twitter and facebook accounts, and the test
> code then as to follow the tweets/posts to see that they get there.
> Assures that things are working, but check the terms of service for these
> providers.  In particular, see if they have some kind of sandbox mode
> (though differences between sandbox and live modes have been a problem for
> me with some services.
>
> 2. Test against your own internal clone of the services.  Now you have
> extra stuff to write, test, and maintain.
>
> 3. Test against a mock network connection and simply capture the data and
> compare it to what you expect.  Getting this working doesn't assure that it
> will work on the site, but once you have stuff working live you can do some
> captures to have better data to test against.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/nyP5oprDBlo/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-admin.py startproject mysite

2013-04-12 Thread James Bennett
The tutorial mentions the most common issues:

* django-admin.py not on your path
* django-admin.py lacking executable permission
* django-admin.py was renamed by your operating system distributor

It also explains how to solve each of those issues.

Have you tried the suggested solutions the tutorial provides?

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django-admin.py startproject mysite

2013-04-12 Thread Kevin Le Bouthillier


django-admin.py startproject mysite


unrecognized command. Why is the python+django setup instructions so unclear? 

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need Advice: Sending Emails

2013-04-12 Thread Kurtis Mullins
Check out sendgrid. If you use Rackspace I think they even give you a good
discount.

You could also just configure everything to use Google's SMTP. I've done
that for quite a few projects.


On Fri, Apr 12, 2013 at 12:19 PM, Tom Evans wrote:

> On Fri, Apr 12, 2013 at 5:01 PM, Venkatraman S  wrote:
> > Looks like an overkill to me. Why setup an SMTP server for this!
> > Are there no other options?
>
> Use your ISPs SMTP server. If your ISP doesn't provide one, you have
> to provide one.
>
> Some MTA has to deliver the email to the right MDA, if your ISP
> doesn't provide one, you have to do it yourself, that's just how email
> works.
>
> Cheers
>
> Tom
>
> --
> 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+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5.1: ORA-01843: not a valid month

2013-04-12 Thread Carsten Fuchs

Am 2013-04-10 17:21, schrieb Carsten Fuchs:

So as was mentioned in the Stackoverflow post, this is likely a problem in 
cx_Oracle
rather than Django...


Well, I probably shouldn't have said this, because this problem did not occur with 
Django 1.4.x, and more importantly, I wonder what should be the next step?


Should I file a bug for Django, re-post at the django-developers list, or try to contact 
the cx_Oracle developers?


Best regards,
Carsten

--
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need Advice: Sending Emails

2013-04-12 Thread Tom Evans
On Fri, Apr 12, 2013 at 5:01 PM, Venkatraman S  wrote:
> Looks like an overkill to me. Why setup an SMTP server for this!
> Are there no other options?

Use your ISPs SMTP server. If your ISP doesn't provide one, you have
to provide one.

Some MTA has to deliver the email to the right MDA, if your ISP
doesn't provide one, you have to do it yourself, that's just how email
works.

Cheers

Tom

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Overriding queryset for inline admin

2013-04-12 Thread Patrick Craston
Hi list

I'm having some trouble overriding the queryset for my inline admin.

Here's a bog-standard parent admin and inline admin:

class MyInlineAdmin(admin.TabularInline):
model = MyInlineModel

def queryset(self, request):
qs = super(MyInlineAdmin, self).queryset(request)
return qs

class ParentAdmin(admin.ModelAdmin):
inlines = [MyInlineAdmin]
admin.site.register(ParentAdminModel, ParentAdmin)


Now I can do qs.filter(user=request.user) or 
qs.filter(date__gte=datetime.today()), no problem.

But what I need is either the MyInlineModel instance or the ParentAdminModel 
instance (not the model!), as I need to filter my queryset based on that.

Is it possible to get something like self.instance or obj (like in 
get_readonly_fields())?

Hope this makes sense. Any help is much appreciated.

Patrick

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need Advice: Sending Emails

2013-04-12 Thread Venkatraman S
Looks like an overkill to me. Why setup an SMTP server for this!
Are there no other options?

On Fri, Apr 12, 2013 at 12:00 PM, Sergiy Khohlov  wrote:

> setup SMTP.  and set your django server as trusted smtp client
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Fri, Apr 12, 2013 at 9:05 AM, Venkatraman S  wrote:
>
>> Well, my Q what should i do so that i get 'delieverd' emails from both
>> django apps and also *nix processes.
>>
>>
>> On Fri, Apr 12, 2013 at 11:11 AM, Sergiy Khohlov wrote:
>>
>>> this is expected behavior.
>>> SMTP server  should blocks attempt to send email from nonauth  client.
>>> In other case it is open relay.
>>>
>>> Many thanks,
>>>
>>> Serge
>>>
>>>
>>> +380 636150445
>>> skype: skhohlov
>>>
>>>
>>> On Thu, Apr 11, 2013 at 9:37 PM, Venkatraman S wrote:
>>>

 Am sure many in this mailing list are running websites that send emails
 to customers from their django applications. And also emails from the
 operating system(like logwatch etc).  I was wondering how you do you
 achieve both?

 For example, when i use a gmail id, i see that i am able to send an
 email from django directly, without setting up anything(no postfix etc).
 The following works, but the same doesn't if i try with a non-gmail id. I
 guess it has to do with my domain provider not allowing certain ports and i
 fear breaking the ToS.

 In settings.py:
 EMAIL_USE_TLS = True
 EMAIL_HOST = 'smtp.gmail.in'
 EMAIL_HOST_USER = 'usern...@gmail.com'
 EMAIL_HOST_PASSWORD = 'pwd'
 EMAIL_PORT = 587

 And from the shell..
 from django.core.mail import EmailMessage
 email = EmailMessage('Hello', 'World', to=['m...@gmail.com'])
 email.send()

 I do not want to take the hassles of setting up an email server for
 sure.  I am just looking for  a simple and maintainable way that confirms
 the deliverability of the email :)

 Venkat

  --
 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+unsubscr...@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?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.



>>>
>>>  --
>>> 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+unsubscr...@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?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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+unsubscr...@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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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+unsubscr...@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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Introducing objpool: a generic object pooling library

2013-04-12 Thread Johannes
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

sounds great. Thanx guys.

On 12.04.2013 11:29, Stratos Psomadakis wrote:
> Hi fellow Django users!
> 
> We are pleased to introduce objpool [1] to the Django community.
> 
> objpool provides a generic library for pooling resources as objects.
> It's being developed by GRNET [2], and used in Synnefo [3]. Synnefo is
> an open source IaaS cloud platform, compliant with the OpenStack APIs,
> which uses Django for the implementation of its (REST) APIs.
> 
> objpool essentially provides a generic abstract pooling class, which one
> can subclass to properly implement pooling for the resources they need.
> We have included the implementation of the HTTP connection pool, which
> we use in Synnefo, in the Git repository [5], which could serve as a
> guideline for implementing your own pools of resources. Except for HTTP
> connections, objpool is used in Synnefo to pool DB connections [6] and
> connections to our own storage backends [7].
> 
> We have published a detailed blog post [4], explaining the reasons that
> led to its development, as well as presenting technical details,
> pitfalls and lessons we learnt on the way.
> 
> We should also note, that Synnefo recommends and uses as its default
> deployment configuration, Gunicorn with async Gevent workers. As a
> result, we've taken special care to make both the abstract pooling class
> and the subclasses we've implemented safe to be used within Greenlets.
> 
> Give it a try, and tell us what you think. Feedback is always welcome!
> 
> You can clone the git repo [1], or use pip to fetch if from PyPi [8]. We
> also provide Debian packages in our apt repository:
> 
> deb http://apt.dev.grnet.gr stable/
> deb-src http://apt.dev.grnet.gr stable/
> 
> # apt-get install python-objpool
> 
> Thanks,
> Stratos
> 
> [1] https://github.com/grnet/objpool
> [2] http://www.grnet.gr/en
> [3] http://www.synnefo.org
> [4]
> http://synnefo-software.blogspot.gr/2013/04/objpool-introducing-general-pooling-in.html
> [5]
> https://github.com/grnet/objpool/blob/dca8c0f129cbd9754c5299d89864828ce93cae56/objpool/http.py#L61
> [6]
> https://code.grnet.gr/projects/synnefo/repository/revisions/1a736ca860cde340940a5ee4babfec9d7b242006/entry/snf-common/synnefo/lib/db/pooled_psycopg2/__init__.py#L168
> [7]
> https://code.grnet.gr/projects/synnefo/repository/revisions/release-0.13/entry/snf-pithos-backend/pithos/backends/util.py
> [8] https://pypi.python.org/pypi/objpool/
> 
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRaCaFAAoJEFGQ0mLhBhx8xXoH+wS1vsctBU6UyjGano/rFYf9
0gobhbX+Agnf/226fL4hElwO3dhn5ymxCp8AcCk0PG3/PeZ/v8sCZZ+wkCIkFzdy
HQ19LvH8FoY3G3wGKaSY9BY08X4FaGM2bLHvGhQyOM7CKNyayQmC1QwC1b8Qo1ta
u+L8aa7NZfU3fzcAP1AiyHNvTcSrIfIxVzJrrav3bkk0igA3xixvU5FWwzkaRCiE
LYZ6ydVCKB5XYmoIdrtauKsTPzsaeTLJ1MK9pqDJTdwKxEIhML55VTeVecc+2+5O
J6Rizp9fjpNDHAu8Mee5E+27/p6ICHxomcL+0e2uSODE7if6otKGBIGZuh2eszE=
=0XGc
-END PGP SIGNATURE-

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django auth user - difference between last login and now

2013-04-12 Thread Jaimin Patel
Hello,

I would like to provide some instructions if user come after gap of 1 week 
or so. I was hoping that I can do that by -

(datetime.now()-user.last_login) > timedelta(days=7)

Though by the time it comes to my view last login is already updated by 
auth user model of django, so in my application code when I try to find 
this difference it always comes 0 day because last_login time is already 
updated with now datetime. 

Is there any other way to get this information? 


-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Oracle database TextField limitations and Django admin interface queries

2013-04-12 Thread Lauri Savolainen
Thank you for the reply,

The field is defined in the Django model as:
location_description = models.TextField(_('additional route information'), 
blank=True)

Data length for the corresponding column in the database seems to be 4000 
and the type is NCLOB. The database is created by Django's syncdb and is 
not a legacy one.

This is the raw SQL query the Django admin interface produces:

SELECT DISTINCT "app_route"."id", 
"app_route"."route_no", 
"app_route"."owner_no", 
"app_route"."municipality_code", 
"app_route"."location_description", 
"app_route"."latitude", 
"app_route"."longitude" 
FROM   "app_route" 
   inner join "app_observationevent" 
   ON ( "app_route"."id" = 
"app_observationevent"."route_id" ) 
WHERE  "app_observationevent"."observation_date" >= :arg0 
ORDER  BY "app_route"."id" DESC 

Executing it via the Django management shell django.db.connection produces 
the same error (ORA-00932: inconsistent datatypes: expected - got NCLOB) 
but when I remove the "app_route"."location_description" field from the 
SELECT projection the query executes successfully.



On Wednesday, April 10, 2013 4:09:43 PM UTC+3, Jani Tiainen wrote:
>
> 10.4.2013 14:45, Lauri Savolainen kirjoitti: 
> > A little background: my application is used to manage observational data 
> > which is collected from designated routes annually. Each route object 
> > has a set of observation events which in turn have a date field. The 
> > data is managed by using a (terrible) customized Django admin interface. 
> > 
> > In the admin interface list view it's possible to search routes using a 
> > custom search box which just injects parameters like ?route_no=1234 and 
> > so forth into the url resulting in a filtered list view. For the most 
> > part this works but when I want to search for routes that, for example, 
> > have observation events past certain date with a query like 
> > ?observationevent__observation_date__gte=2010-01-01 (supposed to show 
> > all routes that have been observed this decade) it raises an 
> > DatabaseError: ORA-00932: inconsistent datatypes: expected - got 
> > NCLOB-exception while using an Oracle database in production. The query 
> > seems to work when using a development SQLite database or doing a query 
> > like 
> > 
> Route.objects.filter(observationevent__observation_date__gte='2012-01-01') 
> > directly in the management console even when using the Oracle production 
> > database. 
> > 
> > According to the general notes on databases the Oracle backend has 
> > limitations with TextField-related queries 
> > (
> https://docs.djangoproject.com/en/dev/ref/databases/#textfield-limitations) 
>
> > and this seems to be causing this as far as I can tell. As the queries 
> > are created by Django admin I have no idea how I should proceed from 
> > here. Is there some kind of easy way to prevent this from happening on 
> > Oracle or should I implement some kind of manual search function? 
> > 
> > I am currently using the following versions: 
> > Django==1.4.5 
> > cx-Oracle==5.1.2 
> > gunicorn==0.17.2 
> > virtualenv==1.5.1 
> > 
>
> Welcome to among us very few and brave to use Oracle... ;) 
>
> What comes to your problem few details are missing but: 
>
> Length of the field in model definition and what column type is in the 
> database. Also it would be helpful to know are you using legacy database? 
>
> Actual error is slightly problematic since it doesn't directly tell what 
> is wrong. It's related types of bind variables and any of them might be 
> incorrect for some reason. 
>
> -- 
> Jani Tiainen 
>
> - Well planned is half done and a half done has been sufficient before... 
>

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




RE: Unable to storing unicode data using django

2013-04-12 Thread Anshum Verma
  Utf8 is default support in django unless you are explicitly typecasting
to str. Please provide details of traceback and code snippets to debug this.


Sent from my Windows Phone
 --
From: sastry mln 
Sent: 12-04-2013 17:29
To: django-users@googlegroups.com
Subject: Unable to storing unicode data using django

Hi All,
  I have a mysqldb with utf8 charset and utf8_general_ci collation. The
tables are also explicity defined to use the same charset/collation
  I have a django model with CharField.
  I want to store unicode characters (hindi language chars)
  when i tested the model form django admin shell, I got error saying that
the character is unrecognised.

  I read the unicode section of the documenation, but i did not understand
clearly.

  can someone please post a snippet about how to let the web application
allow unicode data entry using  (A) from django shell (b) From the data
entry screen created through the modelAdmin forms

regards
mln

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to storing unicode data using django

2013-04-12 Thread Tom Evans
On Fri, Apr 12, 2013 at 6:38 AM, sastry mln  wrote:
> Hi All,
>   I have a mysqldb with utf8 charset and utf8_general_ci collation. The
> tables are also explicity defined to use the same charset/collation
>   I have a django model with CharField.
>   I want to store unicode characters (hindi language chars)
>   when i tested the model form django admin shell, I got error saying that
> the character is unrecognised.
>
>   I read the unicode section of the documenation, but i did not understand
> clearly.
>
>   can someone please post a snippet about how to let the web application
> allow unicode data entry using  (A) from django shell (b) From the data
> entry screen created through the modelAdmin forms
>
> regards
> mln
>

Can you show an example of both cases please - error traceback from
admin page when you get this error, and traceback (and code) from
doing it in the shell.

Unicode usually just works, particularly from the admin. Tracebacks
will probably show why it failed in this case.

Cheers

Tom

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Introducing objpool: a generic object pooling library

2013-04-12 Thread Stratos Psomadakis
Hi fellow Django users!

We are pleased to introduce objpool [1] to the Django community.

objpool provides a generic library for pooling resources as objects.
It's being developed by GRNET [2], and used in Synnefo [3]. Synnefo is
an open source IaaS cloud platform, compliant with the OpenStack APIs,
which uses Django for the implementation of its (REST) APIs.

objpool essentially provides a generic abstract pooling class, which one
can subclass to properly implement pooling for the resources they need.
We have included the implementation of the HTTP connection pool, which
we use in Synnefo, in the Git repository [5], which could serve as a
guideline for implementing your own pools of resources. Except for HTTP
connections, objpool is used in Synnefo to pool DB connections [6] and
connections to our own storage backends [7].

We have published a detailed blog post [4], explaining the reasons that
led to its development, as well as presenting technical details,
pitfalls and lessons we learnt on the way.

We should also note, that Synnefo recommends and uses as its default
deployment configuration, Gunicorn with async Gevent workers. As a
result, we've taken special care to make both the abstract pooling class
and the subclasses we've implemented safe to be used within Greenlets.

Give it a try, and tell us what you think. Feedback is always welcome!

You can clone the git repo [1], or use pip to fetch if from PyPi [8]. We
also provide Debian packages in our apt repository:

deb http://apt.dev.grnet.gr stable/
deb-src http://apt.dev.grnet.gr stable/

# apt-get install python-objpool

Thanks,
Stratos

[1] https://github.com/grnet/objpool
[2] http://www.grnet.gr/en
[3] http://www.synnefo.org
[4]
http://synnefo-software.blogspot.gr/2013/04/objpool-introducing-general-pooling-in.html
[5]
https://github.com/grnet/objpool/blob/dca8c0f129cbd9754c5299d89864828ce93cae56/objpool/http.py#L61
[6]
https://code.grnet.gr/projects/synnefo/repository/revisions/1a736ca860cde340940a5ee4babfec9d7b242006/entry/snf-common/synnefo/lib/db/pooled_psycopg2/__init__.py#L168
[7]
https://code.grnet.gr/projects/synnefo/repository/revisions/release-0.13/entry/snf-pithos-backend/pithos/backends/util.py
[8] https://pypi.python.org/pypi/objpool/




signature.asc
Description: OpenPGP digital signature


Geodjango OGRException when transforming SRID 900913 to SRID 28350 (UTM 50)

2013-04-12 Thread ben . khoo
Hi Everyone,

I was wondering if anyone can shed any light on what I could be doing wrong 
here. I am trying to convert a wkt from SRID 900913 to a wkt in 28350 (UTM 
50). Everything works fine if I go from 900913 -> 4326 but going from 
900913 -> 28350 throws an OGR Exception. 

I'd be grateful if anyone could shed any light on what I could be doing 
wrong. 

Thanks


Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from osgeo import ogr
>>> srs = ogr.osr.SpatialReference()
>>> srs.ImportFromEPSG(28350)
0
>>> print srs.ExportToPrettyWkt()
PROJCS["GDA94 / MGA zone 50",
GEOGCS["GDA94",
DATUM["Geocentric_Datum_of_Australia_1994",
SPHEROID["GRS 1980",6378137,298.257222101,
AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6283"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4283"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",117],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",50],
PARAMETER["false_northing",1000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
AUTHORITY["EPSG","28350"]]
>>> 
>>> from django.contrib.gis.geos import GEOSGeometry
>>> wkt = 'GEOMETRYCOLLECTION (POLYGON ((1496942.7617285000160336 
440277.2828613300225697, 146759.0942870005965233 -371789.7055273400037549, 
1086017.2977249994874001 -1291480.0297266000416130, 
2514472.4821190014481544 -9783.9396191388004809, 1496942.7617285000160336 
440277.2828613300225697)))'
>>> wkt_srid = 900913
>>> 
>>> g = GEOSGeometry(wkt, srid=wkt_srid)
>>> 
>>> g.transform(4326)
>>> print g.srid
4326
>>> 
>>> g = GEOSGeometry(wkt, srid=wkt_srid)
>>> g.transform(28350)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/geos/geometry.py",
 
line 513, in transform
g.transform(ct)
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/gdal/geometries.py",
 
line 414, in transform
capi.geom_transform_to(self.ptr, sr.ptr)
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/gdal/prototypes/errcheck.py",
 
line 108, in check_errcode
check_err(result)
  File 
"/home/benk/workspace/swcc/VirtualEnv/local/lib/python2.7/site-packages/django/contrib/gis/gdal/error.py",
 
line 39, in check_err
raise e(msg)
OGRException: OGR failure.
>>> 
>>> 

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Unable to storing unicode data using django

2013-04-12 Thread sastry mln
Hi All,
  I have a mysqldb with utf8 charset and utf8_general_ci collation. The 
tables are also explicity defined to use the same charset/collation
  I have a django model with CharField.
  I want to store unicode characters (hindi language chars)
  when i tested the model form django admin shell, I got error saying that 
the character is unrecognised.

  I read the unicode section of the documenation, but i did not understand 
clearly.

  can someone please post a snippet about how to let the web application 
allow unicode data entry using  (A) from django shell (b) From the data 
entry screen created through the modelAdmin forms

regards
mln

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Static Files on IIS install

2013-04-12 Thread Mike Dewhirst
You need to make IIS serve the static files from a given location. 

1. Run collectstatic and note where it puts the files (STATIC_ROOT). 

2. Tweak IIS so it connects STATIC_URL to STATIC_ROOT. 

I can't help there because I have never used it. I could help if it was Apache. 

Good luck

Mike

Connected by Motorola

Mark Lybrand  wrote:

>I will read those links as soon as I get a chance. 
>
>
>As for the particulars:
>
>
>Errors: 
>
>"NetworkError: 404 NOT FOUND - 
>http://localhost:8001/static/admin/css/base.css"; 
>
>"NetworkError: 404 NOT FOUND - 
>http://localhost:8001/static/admin/css/dashboard.css";
>
>
>OS: Windows 7
>
>Web server: IIS 7 with FastCGI
>
>Python: 2.7.4
>
>Django: 1.4.5
>
>
>
>Should I post my settings.py file as well?
>
>
>
>
>
>On Thu, Apr 11, 2013 at 10:21 PM, Mike Dewhirst  wrote:
>
>On 12/04/2013 12:56pm, Mark Lybrand wrote:
>
>I have managed to get a Django app installed on IIS7.  It is not finding
>the static files for the admin section.  Can someone give me some
>pointers on the steps I need to take to get static files to work in
>general,
>
>
>https://docs.djangoproject.com/en/1.4/howto/static-files/
>
>This assumes you are using Django 1.4
>
>
>
> as well as specifically how to make my Django app pull the
>
>appropriate static files from the core django package?
>
>
>https://docs.djangoproject.com/en/1.4/howto/static-files/#deploying-static-files-in-a-nutshell
>
>
>
>What information
>
>do you need from me to be able to answer this question?
>
>
>Specific error messages if something fails. Django version. Python version.
>
>If it isn't finding static files there won't necessarily be error messages - 
>you will probably just see raw html. View page source to discover where it is 
>looking for static files and compare what you see with STATIC_URL. IIS has to 
>look in STATIC_ROOT for those.
>
>hth
>
>Mike
>
>
>Thanks in advance.
>
>--
>Mark :)
>
>--
>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+unsubscr...@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?hl=en.
>For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>-- 
>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+unsubscr...@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?hl=en.
>For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>
>-- 
>Mark :) 
>
>-- 
>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+unsubscr...@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?hl=en.
>For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Newbie CSRF protection questions

2013-04-12 Thread Russell Keith-Magee
On Fri, Apr 12, 2013 at 10:49 AM,  wrote:

> Hi,
>
> I'm fairly new to web development and Django, and I'm trying to make sure
> my application is protected against CSRF attacks. I've read through
> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/, but I'm not
> confident I'm understanding it fully. I'd be very grateful for some
> feedback on what I'm doing.
>
> I started by enabling CsrfViewMiddleware. Then I looked at my POST forms:
>
> 1) I have POST forms that go to internal URLs in templates, both in my own
> application and in the registration library I'm using. All of them use the
> csrf_token tag, so I think I'm set there.
>
> 2) I do POSTs to internal URLs from my client-side javascript. Some POSTs
> are already baked into this code, but one gets built on the fly.
>
> My first question comes from the beginning of the doc, where it says,"The
> first defense against CSRF attacks is to ensure that GET requests are
> side-effect free." What's meant by "side effect free"?
>

It means that the request must be idempotent - that if you make the same
request on the server multiple times, that you get the same result each
time.

Broadly speaking, that means that GET requests should be used to retrieve
information, and server updates should be made using a POST request. GET
requests shouldn't modify anything server side - that is, there shouldn't
be any side effects of issuing the GET request.

(There's a little bit more subtlety there if you get into the fine details,
but this will do as a first order approximation)

> I also have a question about this line: "In the corresponding view
> functions, ensure that the 'django.core.context_processors.csrf' context
> processor is being used." I'm interpreting this to mean: "in the view
> functions that are used to render your templates that do POSTs, ensure that
> the csrf context processor is being used." That is, I don't need to worry
> about the context processor in views that are just handling POSTs that
> originate via AJAX from my client side. Am I understanding this correctly?
>

The context processor makes sure that the CSRF token is available to
templates that need to render it. If you have a view that renders a form,
you need to make sure that view has the CSRF context processor in it's
stack, so that the form will render with the token.

If you're doing AJAX, you still need to provide the CSRF token - however
you probably won't be getting that token from the view that serves the AJAX
call. The AJAX view for accepting updates will often have no responsibility
for providing rendered content; in those cases, it doesn't matter if the
AJAX view has access to the CSRF token in template context, because the
template context won't ever be used. You'll still need to get the CSRF
token from *somewhere* though -- either from another view, or by reading a
cookie.

That said, context processors are usually installed on a per-project level,
so *all* views in a given project will have access to the same context
regardless.

> I have one view that handles a webhook/POST that originates from outside
> my site and comes from a non-logged-in-user. I have decorated this view
> with a csrf_exempt decorator and don't return the CSRF token in my
> response. So I think I am covered there -- correct?
>

To be completely certain, we'd need to know details about what the web hook
is using, and how the web hook is being used. In theory, anything without
CSRF protection is potentially subject to a CSRF attack - the question is
whether this poses an actual security risk.

This will largely depend on what the web hook will be actually doing. CSRF
attacks hinge on an attacker convincing a victim to submit a form, and
abusing the fact that the victim is already logged into the friendly system
to get the victim's own credentials to authorise the form submission.

Put it this way - if an attacker were able to pose as any user they wanted,
and could submit anything they wanted through the web hook -- what's the
worst thing they could do? Are they just going to force a view of some data
to update? Or are they going to have authority to clear out someone's bank
account? If it's the former, there's probably no problem removing CSRF
protection. If it's the latter, you'd better not :-)

For the POSTs that originate from my client-side javascript code, I use the
> code given in the doc to get the token from csrf cookie and attach it to
> outgoing AJAX calls to internal URLs for HTTP/HTTPS methods that require
> it. But there is one POST form I build on the fly. Since the page that runs
> that code is generated by a template and the CSRF token is included in the
> context, I included this code:
>
>
>  
>
> var getCSRFToken = function () { return "{% csrf_token %}"; };
>
> 
>
>
> and call the function when I'm building my form. Is that the right way to
> handle this?
>

It's *a* way of handling it. :-)

The downside to this approach is that you can't cache the page (at least,
not a

Re: WSGIPythonPath and

2013-04-12 Thread Roberto López López

Thank you very much Joey and Nik, I will talk about your proposed
solutions with our sysadmin.

Best,

Roberto



On 04/12/2013 01:11 AM, Nikolas Stevenson-Molnar wrote:
> Another direction might be to run a separate WSGI HTTP server (like
> gunicorn) and proxy to it from Apache. Saves the hassle of messing
> around with mod_wsgi.
> 
> _Nik
> 
> On 4/11/2013 3:20 PM, Joey Espinosa wrote:
>>
>> I had basically the same issue as you.
>>
>> With only one Django app deployed, it's easy to just stick your
>> WSGIPythonPath directive in /etc/apache2/apache.conf.
>>
>> But with multiple different virtualenvs, you need to do something like
>> this:
>>
>> http://stackoverflow.com/questions/4614121/running-python-from-a-virtualenv-with-apache-mod-wsgi-on-windows
>>
>> Hope that helps. I've implemented this solution myself.
>>
>> --
>> Joey Espinosa
>> Python Developer
>> http://about.me/joelinux
>>
>> On Apr 11, 2013 5:20 PM, "Roberto López López" > > wrote:
>>
>>
>> Hi Joey,
>>
>> All of them are in different virtualenvs.
>>
>>
>>
>> On 04/11/2013 11:02 PM, Joey Espinosa wrote:
>>>
>>> I meant Python libs/binary.
>>>
>>> --
>>> Joey "JoeLinux" Espinosa
>>> Python Developer
>>> http://about.me/joelinux
>>>
>>> On Apr 11, 2013 5:00 PM, "Joey Espinosa"
>>> mailto:jlouis.espin...@gmail.com>> wrote:
>>>
>>> Do all your sites share the same Python, or are they in
>>> different virtualenvs?
>>>
>>> --
>>> Joey "JoeLinux" Espinosa
>>> Python Developer
>>> http://about.me/joelinux
>>>
>>> On Apr 11, 2013 3:39 PM, "Roberto López López"
>>> mailto:roberto.lo...@uni.no>> wrote:
>>>
>>>
>>> Hi everyone,
>>>
>>> We are trying to deploy a django application on our
>>> apache server
>>> (mod_wsgi) following
>>> 
>>> https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/
>>> We
>>> have different virtualhosts defined as well in httpd.conf.
>>>
>>> We are now stuck, apache is throwing the following error:
>>>
>>> WSGIPythonPath cannot occur within  section
>>>
>>> Can anyone give us any hint? Thank you very much!
>>>
>>> Roberto
>>>
>>>
>>> --
>>> 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+unsubscr...@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?hl=en.
>>> For more options, visit
>>> https://groups.google.com/groups/opt_out.
>>>
>>>
>>> -- 
>>> 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+unsubscr...@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?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>
>> -- 
>> 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+unsubscr...@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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>> -- 
>> 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+unsubscr...@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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
> 
> -- 
> 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-u