Re: Django 1.4 urls.py deprecated, urlpatterns to change

2019-11-09 Thread Motaz Hejaze
You can use path or re_path
 path for normal urls
 re_path for urls containing regular expressions

urlpatterns = [

path('index' , views.index , name='index)

re_path('index/[a-z]*w/' , views.another_index , name='anotherIndex')



On Sat, 9 Nov 2019, 12:47 am Mdlr,  wrote:

> I try to compile an old code in Django 1.4 Many things are deprecated. I
> manage to change some of them but I don't knwo how to go futher on the
> urls.py
>
> here is the old code
>
>
> *from django.conf.urls.defaults import *
> from django.conf import settings
>
> dynurls = patterns('minesweepr.views',
> (r'^api/minesweeper_solve/$', 'api_solve'),
> )
>
> staticurls = patterns('minesweepr.views',
> (r'^player/$', 'template_static'),
> (r'^query/$', 'template_static'),
> )
>
> urlpatterns = patterns('',
> ('^%s' % settings.BASE_URL, include(dynurls)),
> ('^%s' % settings.BASE_STATIC_URL, include(staticurls)),
> )*
>
>
>
> I know django.conf.urls.defaults is deprecated and I tried to change the
> code like this
>
>
>
> *from django.conf.urls import url, include
> from django.conf import settings
>
> dynurls = ['minesweepr.views',
> (r'^api/minesweeper_solve/$', 'api_solve'),
> ]
>
> staticurls = ['minesweepr.views',
> (r'^player/$', 'template_static'),
> (r'^query/$', 'template_static'),
> ]
>
> urlpatterns = ['',
> ('^%s' % settings.BASE_URL, include(dynurls)),
> ('^%s' % settings.BASE_STATIC_URL, include(staticurls)),
> **]*
>
> But it is not sufficient
> It is said my url patterns are invalid.
> Anybody has an idea ?
> Thank you
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f5ff4194-ae39-4020-ab80-9373ea19d15a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f5ff4194-ae39-4020-ab80-9373ea19d15a%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-dopUZETcCid6%2BzzEB_NU6BRNi%2BN98hP2xjR03U22%2BsJg%40mail.gmail.com.


Django 1.4 urls.py deprecated, urlpatterns to change

2019-11-08 Thread Mdlr
 

I try to compile an old code in Django 1.4 Many things are deprecated. I 
manage to change some of them but I don't knwo how to go futher on the 
urls.py

here is the old code 


*from django.conf.urls.defaults import *
from django.conf import settings

dynurls = patterns('minesweepr.views',
(r'^api/minesweeper_solve/$', 'api_solve'),
)

staticurls = patterns('minesweepr.views',
(r'^player/$', 'template_static'),
(r'^query/$', 'template_static'),
)

urlpatterns = patterns('',
('^%s' % settings.BASE_URL, include(dynurls)),
('^%s' % settings.BASE_STATIC_URL, include(staticurls)),
)*



I know django.conf.urls.defaults is deprecated and I tried to change the 
code like this



*from django.conf.urls import url, include
from django.conf import settings

dynurls = ['minesweepr.views',
(r'^api/minesweeper_solve/$', 'api_solve'),
]

staticurls = ['minesweepr.views',
(r'^player/$', 'template_static'),
(r'^query/$', 'template_static'),
]

urlpatterns = ['',
('^%s' % settings.BASE_URL, include(dynurls)),
('^%s' % settings.BASE_STATIC_URL, include(staticurls)),
**]*

But it is not sufficient
It is said my url patterns are invalid. 
Anybody has an idea ?
Thank you

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f5ff4194-ae39-4020-ab80-9373ea19d15a%40googlegroups.com.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2019-05-13 Thread shilpa rani
I am facing similar issue.
How did you check the value of user.backend ??

Thanks,
Shilpa

On Saturday, 14 June 2014 00:26:59 UTC+8, Scott Simmerman wrote:
>
> I faced a similar issue (request.user becoming anonymous after login) and 
> found
> the following solution.  It had to do with the naming convention for the
> auth backend under AUTHENTICATION_BACKENDS in settings.py.  I had a custom
> auth backend class called PamBackend which I had in a file called 
> PamBackend.py.
> I listed it under AUTHENTICATION_BACKENDS as 'auth_backends.PamBackend'. 
>  This
> seemed to work ok--authentication was happening as expected, returning a 
> valid
> user--but the request.user would disappear after a page redirect.
>
> The key is that the backend name is set in the session when authenticate() 
> is
> called (in django.contrib.auth).  It sets the name like this:
>
>user.backend = "%s.%s" % (backend.__module__, 
> backend.__class__.__name__)
>
> So in my case, the name was set to 'auth_backends.PamBackend.PamBackend'.
>
> For a new http request, django checks the session and gets:
> 1) the name of the auth backend, and
> 2) the user id.
> It then calls get_user (in django/contrib/auth/__init__.py) which does the 
> following:
> 1) gets the backend name from the session,
> 2) checks for a match in settings, and
> 3) calls the appropriate get_user method from the appropriate backend.
>
> So at this point, my backend name did not match what was in settings.py and
> it returned an anonymous user.
>
> -Scott
>
> On Monday, October 14, 2013 8:52:57 AM UTC-4, HM wrote:
>>
>> I can't get logging in with alternate auth backends to work with Django 
>> 1.4 or newer.
>>
>> Basically:
>>
>> 1. authenticate() works. request.user.is_authenticated() is True
>> 2. Django's own login() seems to work, as request.user is set, 
>> request.session is set etc.
>> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>>
>> This has happened twice now, with different alternate auth backends. I 
>> can't get rid of Django 1.3 before this is fixed...
>>
>> In one project I can call the next view directly (with render) and it 
>> Just Works. In the current project, the next view contains a form, and the 
>> "login" doesn't survive the POST.
>>
>> What am I missing? See also the non-solution in 
>> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>>
>>
>> HM
>>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d05a4aa8-60dd-484c-88d3-90bc1dfba2c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form on each page problem when upgrading from Django 1.4

2017-11-15 Thread yakkadesign
Anyone else have ideas using the Django backend?

On Sunday, November 12, 2017 at 12:56:53 PM UTC-5, yakka...@gmail.com wrote:
>
> I'm in the process of upgrading a website from Django 1.4 and I'm run into 
> a problem of getting my code that shows a form on almost every page 
> migrated.  I eventually want to upgrade to Django 1.11 but I'm currently 
> working on upgrading from Django 1.4 to Django 1.5.  I have a “request 
> information” form on each page except for a few sign-up pages.  
>
> In Django 1.4 I used direct_to_template for most of the website.  I have a 
>  that is inheirted by each page.  For example , 
> , etc. inherit  from .  In  I load the 
> right columns html with 
> “{% block rightColumn  %} {%include "site/rightColumn.html"%}  
> {%endblock%}” 
> and then in  I load the form's html with 
> “{%include "site/reqInfoForm.html"%}”.  
>
> To get the from on each page I used middleware similar to this 
> http://stackoverflow.com/questions/2734055/putting-a-django-login-form-on-every-page.
>   
> I created a class with a method “def process_view(self, request, view_func, 
> view_args, view_kwargs)”.  In the method if a POST request and not one of 
> the signup pages then I create a form instance from the request and if the 
> form is valid then process it then redirect to thanks page, otherwise 
> attach the form to the request so that I can show the errors in the form 
> template.  
>
> This worked perfectly in Django 1.4 though it seemed like a hack.
>
> While upgrading to Django 1.5 in the url.py I switched from 
> “direct_to_template” to “TemplateView.as_view”.  Now when there is an error 
> in the form (i.e., leave a required field blank), I get an error “"POST / 
> HTTP/1.1" 405 0” while running with the local server.  When I did some 
> research, it appears TemplateView doesn't have a POST method.
>
> It seems one way may be to add TemplateView for each page but it seems 
> like I would have to add a post method for each page(or maybe a mixin).  
> Any thoughts on this method?  I found another method using context 
> processors but I'm not following it.  Also any suggestions on other ways of 
> adding a form to almost all pages?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7115a66a-a38d-4772-b9bd-02086718b945%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form on each page problem when upgrading from Django 1.4

2017-11-15 Thread yakkadesign
 

@Matthew,


It's not a login form. It's a normal form. I don't like the AJAX way. It 
adds moving parts and requires a front end rework (and more tests, browser 
compatibility tests, potential issues with plugins blocking, etc.). 



On Sunday, November 12, 2017 at 12:56:53 PM UTC-5, yakka...@gmail.com wrote:
>
> I'm in the process of upgrading a website from Django 1.4 and I'm run into 
> a problem of getting my code that shows a form on almost every page 
> migrated.  I eventually want to upgrade to Django 1.11 but I'm currently 
> working on upgrading from Django 1.4 to Django 1.5.  I have a “request 
> information” form on each page except for a few sign-up pages.  
>
> In Django 1.4 I used direct_to_template for most of the website.  I have a 
>  that is inheirted by each page.  For example , 
> , etc. inherit  from .  In  I load the 
> right columns html with 
> “{% block rightColumn  %} {%include "site/rightColumn.html"%}  
> {%endblock%}” 
> and then in  I load the form's html with 
> “{%include "site/reqInfoForm.html"%}”.  
>
> To get the from on each page I used middleware similar to this 
> http://stackoverflow.com/questions/2734055/putting-a-django-login-form-on-every-page.
>   
> I created a class with a method “def process_view(self, request, view_func, 
> view_args, view_kwargs)”.  In the method if a POST request and not one of 
> the signup pages then I create a form instance from the request and if the 
> form is valid then process it then redirect to thanks page, otherwise 
> attach the form to the request so that I can show the errors in the form 
> template.  
>
> This worked perfectly in Django 1.4 though it seemed like a hack.
>
> While upgrading to Django 1.5 in the url.py I switched from 
> “direct_to_template” to “TemplateView.as_view”.  Now when there is an error 
> in the form (i.e., leave a required field blank), I get an error “"POST / 
> HTTP/1.1" 405 0” while running with the local server.  When I did some 
> research, it appears TemplateView doesn't have a POST method.
>
> It seems one way may be to add TemplateView for each page but it seems 
> like I would have to add a post method for each page(or maybe a mixin).  
> Any thoughts on this method?  I found another method using context 
> processors but I'm not following it.  Also any suggestions on other ways of 
> adding a form to almost all pages?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d6a505aa-a828-463e-9fcd-b279b399469f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Form on each page problem when upgrading from Django 1.4

2017-11-13 Thread Matthew Pava
That is an interesting setup.  We just use login middleware that automatically 
redirects to the LogIn view with a next GET parameter.

In your situation, I would probably treat the form as ajax and create an ajax 
view for handling the login form processing.  Just change your action URL to 
your ajax login view url.  You would still include the form in the way you have 
and just add some Javascript to the form file.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of yakkades...@gmail.com
Sent: Sunday, November 12, 2017 11:57 AM
To: Django users
Subject: Form on each page problem when upgrading from Django 1.4

I'm in the process of upgrading a website from Django 1.4 and I'm run into a 
problem of getting my code that shows a form on almost every page migrated.  I 
eventually want to upgrade to Django 1.11 but I'm currently working on 
upgrading from Django 1.4 to Django 1.5.  I have a “request information” form 
on each page except for a few sign-up pages.

In Django 1.4 I used direct_to_template for most of the website.  I have a 
 that is inheirted by each page.  For example , 
, etc. inherit  from .  In  I load the 
right columns html with
“{% block rightColumn  %} {%include "site/rightColumn.html"%}  {%endblock%}”
and then in  I load the form's html with
“{%include "site/reqInfoForm.html"%}”.

To get the from on each page I used middleware similar to this 
http://stackoverflow.com/questions/2734055/putting-a-django-login-form-on-every-page.
  I created a class with a method “def process_view(self, request, view_func, 
view_args, view_kwargs)”.  In the method if a POST request and not one of the 
signup pages then I create a form instance from the request and if the form is 
valid then process it then redirect to thanks page, otherwise attach the form 
to the request so that I can show the errors in the form template.

This worked perfectly in Django 1.4 though it seemed like a hack.

While upgrading to Django 1.5 in the url.py I switched from 
“direct_to_template” to “TemplateView.as_view”.  Now when there is an error in 
the form (i.e., leave a required field blank), I get an error “"POST / 
HTTP/1.1" 405 0” while running with the local server.  When I did some 
research, it appears TemplateView doesn't have a POST method.

It seems one way may be to add TemplateView for each page but it seems like I 
would have to add a post method for each page(or maybe a mixin).  Any thoughts 
on this method?  I found another method using context processors but I'm not 
following it.  Also any suggestions on other ways of adding a form to almost 
all pages?
--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52c882b9-09d5-4b58-8234-b967785650de%40googlegroups.com<https://groups.google.com/d/msgid/django-users/52c882b9-09d5-4b58-8234-b967785650de%40googlegroups.com?utm_medium=email_source=footer>.
For more options, visit https://groups.google.com/d/optout.

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


Form on each page problem when upgrading from Django 1.4

2017-11-12 Thread yakkadesign
I'm in the process of upgrading a website from Django 1.4 and I'm run into 
a problem of getting my code that shows a form on almost every page 
migrated.  I eventually want to upgrade to Django 1.11 but I'm currently 
working on upgrading from Django 1.4 to Django 1.5.  I have a “request 
information” form on each page except for a few sign-up pages.  

In Django 1.4 I used direct_to_template for most of the website.  I have a 
 that is inheirted by each page.  For example , 
, etc. inherit  from .  In  I load the 
right columns html with 
“{% block rightColumn  %} {%include "site/rightColumn.html"%}  
{%endblock%}” 
and then in  I load the form's html with 
“{%include "site/reqInfoForm.html"%}”.  

To get the from on each page I used middleware similar to this 
http://stackoverflow.com/questions/2734055/putting-a-django-login-form-on-every-page.
  
I created a class with a method “def process_view(self, request, view_func, 
view_args, view_kwargs)”.  In the method if a POST request and not one of 
the signup pages then I create a form instance from the request and if the 
form is valid then process it then redirect to thanks page, otherwise 
attach the form to the request so that I can show the errors in the form 
template.  

This worked perfectly in Django 1.4 though it seemed like a hack.

While upgrading to Django 1.5 in the url.py I switched from 
“direct_to_template” to “TemplateView.as_view”.  Now when there is an error 
in the form (i.e., leave a required field blank), I get an error “"POST / 
HTTP/1.1" 405 0” while running with the local server.  When I did some 
research, it appears TemplateView doesn't have a POST method.

It seems one way may be to add TemplateView for each page but it seems like 
I would have to add a post method for each page(or maybe a mixin).  Any 
thoughts on this method?  I found another method using context processors 
but I'm not following it.  Also any suggestions on other ways of adding a 
form to almost all pages?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52c882b9-09d5-4b58-8234-b967785650de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade from django 1.4 to django 1.11

2017-03-07 Thread ludovic coues
By upgrading directly from 1.4 to 1.11, deprecation warning might be
missed, resulting in a non-working project with few indication of what
is wrong.

2017-03-07 13:07 GMT+01:00 Antonis Christofides <anto...@djangodeployment.com>:
> There is no inherent reason for doing it a step at a time; you can go
> directly to 1.11 (which, btw, hasn't been released yet, it's in alpha I
> think, so it may or may not be ok for you).
>
> Doing it in steps might be better if you intend to read the release notes.
> So you read the release notes for 1.5, you go to 1.5, then you read the
> release notes for 1.6, you go to 1.6, etc. But I don't think it's worth it
> (and it's huge work to read the release notes for all these versions, and it
> will take ages to sink in anyway).
>
> However, you should at least read about the major changes in all the release
> notes.
>
> What I'd do would be to install Django 1.11 and test. You'll get an error
> message. Read the relevant part of the release notes. Fix it. Next error
> message. And so on. It's easier if you have good unit testing. If you don't,
> it's a great opportunity to start.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> http://djangodeployment.com
>
>
> On 03/07/2017 11:38 AM, BIJAL MANIAR wrote:
>
>
> Hi,
>
> Currently we have an application built using django 1.4.
> As the latest LTS release is 1.11, we are planning to upgrade it to 1.11.
>
> Which of the below 3 alternatives is a better option for django version
> upgrade.
> 1. Should we take it one release at a time? ie, Make the jump from 1.4 to
> 1.5 first, then proceed to 1.6, and so on.
> 2. Upgrade directly to 1.11
> 3. Upgrade only to LTS release ie, 1.4 to 1.8 to 1.11
>
> What other things we should consider before upgrading eg, having testcases
> in place.
> Any links/suggestions will be helpful.
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8a24c1d5-6dc5-4963-84de-4e67ffbf15fb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fa9fa0f6-407e-cb96-2e22-795867a58b29%40djangodeployment.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTaKdCBnroXi%3D7ofhaUU0Yr02037z5yZKsAZfd%2BSrMdv3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade from django 1.4 to django 1.11

2017-03-07 Thread Tim Graham
Here's the "official advice": 
https://docs.djangoproject.com/en/dev/howto/upgrade-version/

On Tuesday, March 7, 2017 at 6:55:22 AM UTC-5, BIJAL MANIAR wrote:
>
>
> Hi,
>
> Currently we have an application built using django 1.4. 
> As the latest LTS release is 1.11, we are planning to upgrade it to 1.11.
>
> Which of the below 3 alternatives is a better option for django version 
> upgrade.
> 1. Should we take it one release at a time? ie, Make the jump from 1.4 to 
> 1.5 first, then proceed to 1.6, and so on.
> 2. Upgrade directly to 1.11 
> 3. Upgrade only to LTS release ie, 1.4 to 1.8 to 1.11
>
> What other things we should consider before upgrading eg, having testcases 
> in place.
> Any links/suggestions will be helpful. 
>
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3dd7154e-4181-4a26-9424-bdba2a3a9beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade from django 1.4 to django 1.11

2017-03-07 Thread Antonis Christofides
There is no inherent reason for doing it a step at a time; you can go directly
to 1.11 (which, btw, hasn't been released yet, it's in alpha I think, so it may
or may not be ok for you).

Doing it in steps might be better if you intend to read the release notes. So
you read the release notes for 1.5, you go to 1.5, then you read the release
notes for 1.6, you go to 1.6, etc. But I don't think it's worth it (and it's
huge work to read the release notes for all these versions, and it will take
ages to sink in anyway).

However, you should at least read about the major changes in all the release 
notes.

What I'd do would be to install Django 1.11 and test. You'll get an error
message. Read the relevant part of the release notes. Fix it. Next error
message. And so on. It's easier if you have good unit testing. If you don't,
it's a great opportunity to start.

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com


On 03/07/2017 11:38 AM, BIJAL MANIAR wrote:
>
> Hi,
>
> Currently we have an application built using django 1.4. 
> As the latest LTS release is 1.11, we are planning to upgrade it to 1.11.
>
> Which of the below 3 alternatives is a better option for django version 
> upgrade.
> 1. Should we take it one release at a time? ie, Make the jump from 1.4 to 1.5
> first, then proceed to 1.6, and so on.
> 2. Upgrade directly to 1.11 
> 3. Upgrade only to LTS release ie, 1.4 to 1.8 to 1.11
>
> What other things we should consider before upgrading eg, having testcases in
> place.
> Any links/suggestions will be helpful. 
>
> 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8a24c1d5-6dc5-4963-84de-4e67ffbf15fb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8a24c1d5-6dc5-4963-84de-4e67ffbf15fb%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fa9fa0f6-407e-cb96-2e22-795867a58b29%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Upgrade from django 1.4 to django 1.11

2017-03-07 Thread BIJAL MANIAR

Hi,

Currently we have an application built using django 1.4. 
As the latest LTS release is 1.11, we are planning to upgrade it to 1.11.

Which of the below 3 alternatives is a better option for django version 
upgrade.
1. Should we take it one release at a time? ie, Make the jump from 1.4 to 
1.5 first, then proceed to 1.6, and so on.
2. Upgrade directly to 1.11 
3. Upgrade only to LTS release ie, 1.4 to 1.8 to 1.11

What other things we should consider before upgrading eg, having testcases 
in place.
Any links/suggestions will be helpful. 

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a24c1d5-6dc5-4963-84de-4e67ffbf15fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrate Data from Django 1.4 to Django 1.8

2016-02-22 Thread Andreas Kuhne
Hi,

I did that a while back, I wrote my own SQL migration script that we tested
with the production database in development. I think that would be the only
way. Django doesn't know of the changes that you have made in your database
models. However if you had started with the production database and then
migrated up to the new layout in development, then that would have been
possible.

Regards,

Andréas

2016-02-22 15:18 GMT+01:00 Mayur Tanna <mayur.ta...@wishtreetech.com>:

> Hi,
>
>
> We have migrated the Django 1.4 application to Django 1.8 successfully.
> The Django 1.4 version of applicaiton is still in use in production until
> we go live with Django 1.8. The problem is that lots of data have been
> updated on production server which needs to be migrated to 1.8 version on
> local enviroment. Is there any way I can migrate the data from database of
> 1.4 to 1.8 except manually doing that? Note that the model/database columns
> are different in both the version.
>
> Can anybody suggest some good options ?
>
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b9837af1-5ccd-46b1-9a80-b28712922923%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b9837af1-5ccd-46b1-9a80-b28712922923%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Migrate Data from Django 1.4 to Django 1.8

2016-02-22 Thread Mayur Tanna


Hi,


We have migrated the Django 1.4 application to Django 1.8 successfully. The 
Django 1.4 version of applicaiton is still in use in production until we go 
live with Django 1.8. The problem is that lots of data have been updated on 
production server which needs to be migrated to 1.8 version on local 
enviroment. Is there any way I can migrate the data from database of 1.4 to 
1.8 except manually doing that? Note that the model/database columns are 
different in both the version.

Can anybody suggest some good options ?


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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b9837af1-5ccd-46b1-9a80-b28712922923%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.4 - how to display a success message on form save

2015-08-04 Thread Sammy
I'm pretty sure you have to use AJAX to display the message without reloading.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c8ddd5c1-19cf-4527-8551-d27c354fd2b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.4 - how to display a success message on form save

2015-08-03 Thread Iyengar8
But the message gets displayed only after I reload the page, the page isn't 
updated.

On Tuesday, 26 June 2012 08:46:04 UTC-4, JirkaV wrote:
>
> >> @Jirka - thanks. I saw something about the messaging framework and even 
> >> tried one example which did not work. 
>
> Using the messaging framework is actually very simple. 
>
> You need to enable the messaging framework (see the steps here: 
> https://docs.djangoproject.com/en/1.4/ref/contrib/messages/ ) 
>
> In your template, you need this (I have that in my base template so 
> it's included in all pages): 
>
>   {% if messages %} 
> {% for message in messages %} 
>   {{ message }} 
> {% endfor %} 
>   {% endif %} 
>
> Obviously, you'll need some formatting/CSS around it. 
>
> And in your views.py (or forms.py, ...) 
>
> from django.contrib import messages 
>
>if form.is_valid(): 
>  messages.success(request, 'Your form was saved') 
>
> And that's it! 
>
>
>Jirka 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a76615b9-077a-4ccb-a278-158e1cd7f755%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.4 (LTS) end of life?

2015-06-27 Thread Tim Graham
EOL for 1.4 remains October 1. For future reference, see the table on the 
download page: https://www.djangoproject.com/download/

On Friday, June 26, 2015 at 7:22:01 PM UTC-4, Ned Horvath wrote:
>
> Originally 1.4 was supposed to end support with the release of 1.8; 
> earlier this year that was extended 6 months to October 1, 2015. But as of 
> yesterday, the revised roadmap shows 1.9 planned for "December" rather than 
> the previous target of October 2.
>
> I don't know whether to pressure the developers I support at UT Austin to 
> get off 1.4 by October 1, or if 1.4 support was implicitly tied to the 
> release of 1.9 and has therefore been extended a couple of months. I'm 
> happy with either answer, I just want to know how hard to push!
>
> Any guidance from the Django committers gratefully accepted.
>
> Ned Horvath
> Python Production Environment lead
> UT Austin
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2f94b9e4-a160-4fc5-b25b-0e5e4a900484%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.4 (LTS) end of life?

2015-06-26 Thread Ned Horvath
Originally 1.4 was supposed to end support with the release of 1.8; earlier 
this year that was extended 6 months to October 1, 2015. But as of 
yesterday, the revised roadmap shows 1.9 planned for "December" rather than 
the previous target of October 2.

I don't know whether to pressure the developers I support at UT Austin to 
get off 1.4 by October 1, or if 1.4 support was implicitly tied to the 
release of 1.9 and has therefore been extended a couple of months. I'm 
happy with either answer, I just want to know how hard to push!

Any guidance from the Django committers gratefully accepted.

Ned Horvath
Python Production Environment lead
UT Austin

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25e38e88-0986-43da-9cc5-362bd0e1bb31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.6 vs Django 1.4, creation of child instance immediately referenced by parent?

2015-02-24 Thread Pongetti
Hello all,

I started a project way back in the days of Django 1.4.  I am trying to 
upgrade to version 1.6 to make use of some new features.

Anyway, I am coming across this curious change.  Its probably meant to be a 
fix rather than a bug, but its causing huge issues with my code and I did 
not find anything that I thought dealt with it in the release notes, nor 
anybody else mentioning it in my Googles.

Take a very simple Parent->Child relationship:
class TestModel(models.Model):
pass
 
class TestModelChild(models.Model):
parent = models.OneToOneField(TestModel)

Now run this simple code
parent = TestModel()
child = TestModelChild(parent=parent)

print parent.testmodelchild

In Django 1.4, the final line would raise an exception as the parent model 
does not have any reference to the child at this point
In Django 1.6, the parent can immediately see the "child" instance.  Its 
already there

Seems logical, and I'm guessing necessary for the new transaction model, 
but as I said, causing huge problems and I can't find anything to warn me 
of it.  Wasn't sure whether to ask how to fix it, report it as a bug or 
ignore it.  Thought I'd post here, maybe someone has a suggestion?

BTW, the reason its causing me issues specifically?
I have one view with a two ModelForms, one for the parent, one for the 
child, and I initialize them like so:

form_parent = TestModelForm(request.POST, instance=parent)
form_child = TestModelForm(request.POST, instance=child)
form_parent.save()
form_child.save()

form_parent.save() causes an exception as its save function is overridden 
and does some work on the child if it exists.  In 1.4 it didn't exist yet 
on first save of the parent.  In 1.6 the child exists even though it really 
shouldn't yet.  There are many solutions to this and I could fix this case 
easily but my code base is so huge at this point and I've used this process 
a lot, I have no confidence in upgrading from 1.4 if this is the case.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2cffb612-7a20-4402-9b27-2b0af2f73e13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does ticket 19866 apply to Django 1.4

2014-12-06 Thread Collin Anderson
Hi Brian,

If you're behind nginx, you can filter the hostname there before it hits 
django. I usually add an empty server {} block at the beginning of my conf 
to act as the default and catch server host names that are not defined so 
they don't hit django.

Collin

On Friday, December 5, 2014 12:15:41 AM UTC-5, yakka...@gmail.com wrote:
>
> Does ticket 19866 <https://code.djangoproject.com/ticket/19866> apply to 
> Django 1.4? Reading through the notes, it seems it does but I'm still 
> getting a 500 error. If not, is there a way to keep Django from returning a 
> 500 error.  I've found other people filtering these out.  I don't want to 
> filter them out. 
>
>
>  I've got some hackers trying to exploit the wordpress /xmlrpc.php on my 
> Django site. Most of the time they are coming back 404 but there are times 
> I'm getting exceptions like:
>
> ---Traceback (most recent call last):
>
>   File 
> "/usr/local/python2p7/lib/python2.7/site-packages/django/core/handlers/base.py",
>  line 87, in get_response
> response = middleware_method(request)
>
>   File 
> "/usr/local/python2p7/lib/python2.7/site-packages/django/middleware/common.py",
>  line 55, in process_request
> host = request.get_host()
>
>   File 
> "*/usr/local/python2p7/lib/python2.7/site-packages/django/http/*__init__.py", 
> line 223, in get_host
> "Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)
>
> SuspiciousOperation: Invalid HTTP_HOST header (you may need to set 
> ALLOWED_HOSTS) path:/wp/xmlrpc.php,
> ...
>  'HTTP_USER_AGENT': 'LWP::Simple/6.00 libwww-perl/6.04',
>
> ...
>
>
>  'REQUEST_URI': '/wp/xmlrpc.php',
>
>
>  ---
>
>
>  Brian
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f66401b5-5f94-4d5d-be77-88ac89eb8890%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does ticket 19866 apply to Django 1.4

2014-12-05 Thread Carl Meyer
Hi Brian,

On 12/04/2014 10:15 PM, yakkades...@gmail.com wrote:
> 
> Does ticket 19866 <https://code.djangoproject.com/ticket/19866> apply to 
> Django 1.4? Reading through the notes, it seems it does but I'm still 
> getting a 500 error. If not, is there a way to keep Django from returning a 
> 500 error.  I've found other people filtering these out.  I don't want to 
> filter them out. 

I'm not sure what you mean by "apply to". That ticket is a problem in
1.4, but it is not fixed in 1.4; it was first fixed in 1.6 (you can see
this by following the link in the last comment to the GitHub commit that
fixed it, and then looking at the list GitHub gives you of the
branches/tags containing the commit). So it's not surprising that you're
seeing it as a problem in 1.4.

I think your options are a) upgrade to 1.6+, b) filter these reports, or
c) live with the reports.

Carl

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5481EDE5.3000403%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Does ticket 19866 apply to Django 1.4

2014-12-04 Thread yakkadesign
 

Does ticket 19866 <https://code.djangoproject.com/ticket/19866> apply to 
Django 1.4? Reading through the notes, it seems it does but I'm still 
getting a 500 error. If not, is there a way to keep Django from returning a 
500 error.  I've found other people filtering these out.  I don't want to 
filter them out. 


 I've got some hackers trying to exploit the wordpress /xmlrpc.php on my 
Django site. Most of the time they are coming back 404 but there are times 
I'm getting exceptions like:

---Traceback (most recent call last):

  File 
"/usr/local/python2p7/lib/python2.7/site-packages/django/core/handlers/base.py",
 line 87, in get_response
response = middleware_method(request)

  File 
"/usr/local/python2p7/lib/python2.7/site-packages/django/middleware/common.py", 
line 55, in process_request
host = request.get_host()

  File 
"*/usr/local/python2p7/lib/python2.7/site-packages/django/http/*__init__.py", 
line 223, in get_host
"Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)

SuspiciousOperation: Invalid HTTP_HOST header (you may need to set 
ALLOWED_HOSTS)http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d1ba4c11-1158-474f-9a4b-91b288d25e93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2014-06-13 Thread Scott Simmerman
I faced a similar issue (request.user becoming anonymous after login) and 
found
the following solution.  It had to do with the naming convention for the
auth backend under AUTHENTICATION_BACKENDS in settings.py.  I had a custom
auth backend class called PamBackend which I had in a file called 
PamBackend.py.
I listed it under AUTHENTICATION_BACKENDS as 'auth_backends.PamBackend'. 
 This
seemed to work ok--authentication was happening as expected, returning a 
valid
user--but the request.user would disappear after a page redirect.

The key is that the backend name is set in the session when authenticate() 
is
called (in django.contrib.auth).  It sets the name like this:

   user.backend = "%s.%s" % (backend.__module__, backend.__class__.__name__)

So in my case, the name was set to 'auth_backends.PamBackend.PamBackend'.

For a new http request, django checks the session and gets:
1) the name of the auth backend, and
2) the user id.
It then calls get_user (in django/contrib/auth/__init__.py) which does the 
following:
1) gets the backend name from the session,
2) checks for a match in settings, and
3) calls the appropriate get_user method from the appropriate backend.

So at this point, my backend name did not match what was in settings.py and
it returned an anonymous user.

-Scott

On Monday, October 14, 2013 8:52:57 AM UTC-4, HM wrote:
>
> I can't get logging in with alternate auth backends to work with Django 
> 1.4 or newer.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set, 
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I 
> can't get rid of Django 1.3 before this is fixed...
>
> In one project I can call the next view directly (with render) and it Just 
> Works. In the current project, the next view contains a form, and the 
> "login" doesn't survive the POST.
>
> What am I missing? See also the non-solution in 
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>
>
> HM
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e32eb77-6b2f-4d02-9b92-d9b2f667a3a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.4 : gunicorn can't find static files. settings option

2014-01-05 Thread Denis Cornehl
Hi, 

if you don’t have a web server available (for example on some PaaS like 
Heroku), you can do two things for production-ready static file serving: 

- use an external service like Amazon S3 (with the help of django-storages)
- use dj-static, which uses an WSGI middleware to serve your static files and 
integrates into django (alternative is SharedDataMiddlware of werkzeug, used by 
flask)

Don’t forget that you have to run „./mange.py collectstatic“ to gather all the 
files in one directory. 

Am 05.01.2014 um 10:10 schrieb Mahdi Mazaheri <me.mazah...@gmail.com>:

> Hi Huseyin,
> 
> I have the same problem as Bo but this again did not solve my problem. This 
> works with django webserver (runserver) but not with gunicorn.
> Any Ideas?
> 
> Thanks in advance
> Mahdi
> 
> On Wednesday, May 16, 2012 10:38:39 AM UTC+4:30, huseyin yilmaz wrote:
> For development, you could add this to main urls.py like this. 
> (r'^static/(?P.*)$', 'django.views.static.serve', 
> {'document_root': settings.STATIC_ROOT, 'show_indexes':True}), 
> 
> But for production use your web server to serve static files. 
> 
> At least this is how I solved it. I hope that helps. 
> 
> On May 16, 5:56 am, Bolang <boo.l...@gmail.com> wrote: 
> > Hi, 
> > I just started to using django 1.4 with gunicorn 0.14.3 
> > With ./manage.py runserver , i can start django properly and django can 
> > find my files in static directory. 
> > Then i use gunicorn and then gunicorn can't find my files in static 
> > directory. 
> > 
> > I have tried these combination 
> > gunicorn myproject.wsgi:application --settings myproject.settings 
> > gunicorn myproject.wsgi:application --settings 
> > /absolute/path/to/settings.py 
> > ./manage.py run_gunicorn --settings=myproject.settings 
> > 
> > All of the commands can start django, but can't find my files in static 
> > directory 
> > 
> > I also found this issuehttps://github.com/benoitc/gunicorn/issues/322 
> > But, i can't find the solution from that page. 
> > 
> > Any kind of help will be appreciated 
> > 
> > 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/6e99aaf4-44e9-4fff-8ada-d5fc96e55d7b%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Freundliche Grüße

Denis Cornehl
Simon-Dach-Str. 7 / 10245 Berlin

M: +49 (151) 25 25 1450
@: denis.corn...@gmail.com

X: http://xing.to/dc

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0776FEBD-5BA3-4E3C-B3B1-39836E2CF646%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django 1.4 : gunicorn can't find static files. settings option

2014-01-05 Thread Mahdi Mazaheri
Hi Huseyin,

I have the same problem as Bo but this again did not solve my problem. This 
works with django webserver (runserver) but not with gunicorn.
Any Ideas?

Thanks in advance
Mahdi

On Wednesday, May 16, 2012 10:38:39 AM UTC+4:30, huseyin yilmaz wrote:
>
> For development, you could add this to main urls.py like this. 
> (r'^static/(?P.*)$', 'django.views.static.serve', 
> {'document_root': settings.STATIC_ROOT, 'show_indexes':True}), 
>
> But for production use your web server to serve static files. 
>
> At least this is how I solved it. I hope that helps. 
>
> On May 16, 5:56 am, Bolang <boo.l...@gmail.com> wrote: 
> > Hi, 
> > I just started to using django 1.4 with gunicorn 0.14.3 
> > With ./manage.py runserver , i can start django properly and django can 
> > find my files in static directory. 
> > Then i use gunicorn and then gunicorn can't find my files in static 
> > directory. 
> > 
> > I have tried these combination 
> > gunicorn myproject.wsgi:application --settings myproject.settings 
> > gunicorn myproject.wsgi:application --settings 
> /absolute/path/to/settings.py 
> > ./manage.py run_gunicorn --settings=myproject.settings 
> > 
> > All of the commands can start django, but can't find my files in static 
> > directory 
> > 
> > I also found this issuehttps://github.com/benoitc/gunicorn/issues/322 
> > But, i can't find the solution from that page. 
> > 
> > Any kind of help will be appreciated 
> > 
> > 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6e99aaf4-44e9-4fff-8ada-d5fc96e55d7b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-11-11 Thread Hanne Moa
The fix that worked for 1.4.x did not work for 1.5.x.

Only thing that worked for 1.5.x was changing how apache called django, by
setting WSGIDaemonProcess to "processes=1" or removing "processes" entirely
("threads" can be lots more than one). Something has obviously changed in
how django does wsgi but I won't be spending more time trying to find out
why.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrrcXYdKFJ50V4VJsR%3DbpO1pFUfX5xmOXs_zzd5j4DVC%3DgA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-22 Thread Praveen Madhavan
Hi,
Can you please exlpain it further. I am facing the same issue. I have 
written a get_user() method in my customauthentication.py. My 
authentication is successful but the subsequent requests show up as 
anonymous user.

Thanks
Praveen.M


On Monday, 21 October 2013 16:28:12 UTC+5:30, HM wrote:
>
> Turns out: the auth backend that worked in 1.3 but not in 1.4+ was missing 
> a get_user()-method. I added it in and that was that.
>
>
> HM
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6415f4cb-2319-4f64-955b-09be2094bf0a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-21 Thread Hanne Moa
Turns out: the auth backend that worked in 1.3 but not in 1.4+ was missing
a get_user()-method. I added it in and that was that.


HM

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3Drrc8yF%2BFq4BNm-ER0OTxVpDfDadrNtP8SMi30neVNswJNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
On 14 October 2013 17:06, Tom Evans <tevans...@googlemail.com> wrote:

> On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa <hanne@gmail.com> wrote:
> > I can't get logging in with alternate auth backends to work with Django
> 1.4
> > or newer.
>


> Are you sure sessions are working correctly? Are you setting cookies
> (for session or otherwise) with a different host name than you are
> serving from?
>
> Thx for the suggestion. With 1.3.1, a secure sessionid and and a csrf
token is set. With 1.5.4. the secure session id is also httponly, and the
csrftoken is also set. That's the only difference cookie-wise. I think I'll
dump the contents of the sessions to see what's going on.


HM

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrrfhybFuTJt4qgB-8OyxEnx2qZW%3DQVFzrW5Aqs8nrpxAWw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Tom Evans
On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa <hanne@gmail.com> wrote:
> I can't get logging in with alternate auth backends to work with Django 1.4
> or newer.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
>
> In one project I can call the next view directly (with render) and it Just
> Works. In the current project, the next view contains a form, and the
> "login" doesn't survive the POST.
>
> What am I missing? See also the non-solution in
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>

Are you sure sessions are working correctly? Are you setting cookies
(for session or otherwise) with a different host name than you are
serving from?

Use a browser that allows you to inspect and capture web requests
(chrome, firefox etc), capture the login sequence and look at the
cookies that are being set.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2BJG9qmAYCk5bEvK%2BOa6YdQ3CiJuKN3gRka6SzfvK7fhw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Sergiy Khohlov
Please post a example code.
one user  with two password with different permission  is not easy to
understand idea for me :-)
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Mon, Oct 14, 2013 at 4:14 PM, Hanne Moa <hanne@gmail.com> wrote:
> That's not my code, that's the first hit on google for my problem. I use
> django's own login() to login the user.
>
>
> On 14 October 2013 15:07, Sergiy Khohlov <skhoh...@gmail.com> wrote:
>>
>>  Take a look  at :
>> if form.is_valid():
>> #django.contrib.auth.login
>> Login(request, form.get_user())
>> str = reverse('cm_base.views.index')
>> return HttpResponseRedirect(str)
>> else:
>> # Their password / email combination must have been incorrect
>> pass
>>
>> you  are verifying fields only. No more. And invalid creadentials (
>> correct for form) are  never go to else  block
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>>
>> On Mon, Oct 14, 2013 at 4:01 PM, Sergiy Khohlov <skhoh...@gmail.com>
>> wrote:
>> > I have no idea why are you writing this code  by yourself ?
>> >  This  is already done  !
>> >  Take a look at
>> >
>> > https://github.com/django/django/blob/master/django/contrib/auth/views.py
>> >
>> >  login function is already done  and you can  use it .  Have no sense
>> > to write it by yourself.
>> > Many thanks,
>> >
>> > Serge
>> >
>> >
>> > +380 636150445
>> > skype: skhohlov
>> >
>> >
>> > On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa <hanne@gmail.com> wrote:
>> >> I can't get logging in with alternate auth backends to work with Django
>> >> 1.4
>> >> or newer.
>> >>
>> >> Basically:
>> >>
>> >> 1. authenticate() works. request.user.is_authenticated() is True
>> >> 2. Django's own login() seems to work, as request.user is set,
>> >> request.session is set etc.
>> >> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>> >>
>> >> This has happened twice now, with different alternate auth backends. I
>> >> can't
>> >> get rid of Django 1.3 before this is fixed...
>> >>
>> >> In one project I can call the next view directly (with render) and it
>> >> Just
>> >> Works. In the current project, the next view contains a form, and the
>> >> "login" doesn't survive the POST.
>> >>
>> >> What am I missing? See also the non-solution in
>> >>
>> >> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>> >>
>> >>
>> >> HM
>> >>
>> >> --
>> >> 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.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
>> >> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CADTRxJOnf8EkaR6tU5YMcKQ64GNOrHP7ShGKy2s4Wo6%3Dq1WU%3Dg%40mail.gmail.com.
>>
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACQ%3Drre2CHhJdbX2gwObHOZkioZ-6H0vjCK-ujvBfYPjNewx3g%40mail.gmail.com.
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJO12SDeJ3C-4xvpemE-N0rg2fY%2Bp3dUUy%3DNzTeN8Hwtqg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
That's not my code, that's the first hit on google for my problem. I use
django's own login() to login the user.


On 14 October 2013 15:07, Sergiy Khohlov <skhoh...@gmail.com> wrote:

>  Take a look  at :
> if form.is_valid():
> #django.contrib.auth.login
> Login(request, form.get_user())
> str = reverse('cm_base.views.index')
> return HttpResponseRedirect(str)
> else:
> # Their password / email combination must have been incorrect
> pass
>
> you  are verifying fields only. No more. And invalid creadentials (
> correct for form) are  never go to else  block
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Mon, Oct 14, 2013 at 4:01 PM, Sergiy Khohlov <skhoh...@gmail.com>
> wrote:
> > I have no idea why are you writing this code  by yourself ?
> >  This  is already done  !
> >  Take a look at
> >
> https://github.com/django/django/blob/master/django/contrib/auth/views.py
> >
> >  login function is already done  and you can  use it .  Have no sense
> > to write it by yourself.
> > Many thanks,
> >
> > Serge
> >
> >
> > +380 636150445
> > skype: skhohlov
> >
> >
> > On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa <hanne@gmail.com> wrote:
> >> I can't get logging in with alternate auth backends to work with Django
> 1.4
> >> or newer.
> >>
> >> Basically:
> >>
> >> 1. authenticate() works. request.user.is_authenticated() is True
> >> 2. Django's own login() seems to work, as request.user is set,
> >> request.session is set etc.
> >> 3. After the HttpResponseRedirect, request.user is AnonymousUser
> >>
> >> This has happened twice now, with different alternate auth backends. I
> can't
> >> get rid of Django 1.3 before this is fixed...
> >>
> >> In one project I can call the next view directly (with render) and it
> Just
> >> Works. In the current project, the next view contains a form, and the
> >> "login" doesn't survive the POST.
> >>
> >> What am I missing? See also the non-solution in
> >>
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
> >>
> >>
> >> HM
> >>
> >> --
> >> 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.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com
> .
> >> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADTRxJOnf8EkaR6tU5YMcKQ64GNOrHP7ShGKy2s4Wo6%3Dq1WU%3Dg%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3Drre2CHhJdbX2gwObHOZkioZ-6H0vjCK-ujvBfYPjNewx3g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
Why not assume that I have a reason not to use the ready-made stuff?

The User-object has several passwords connected, wuhch represent passwords
elsewhere, which can be different. Which password to check is set on the
login-page, and after login the only page available is one where those
passwords can be changed.


On 14 October 2013 15:01, Sergiy Khohlov <skhoh...@gmail.com> wrote:

> I have no idea why are you writing this code  by yourself ?
>  This  is already done  !
>  Take a look at
> https://github.com/django/django/blob/master/django/contrib/auth/views.py
>
>  login function is already done  and you can  use it .  Have no sense
> to write it by yourself.
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa <hanne@gmail.com> wrote:
> > I can't get logging in with alternate auth backends to work with Django
> 1.4
> > or newer.
> >
> > Basically:
> >
> > 1. authenticate() works. request.user.is_authenticated() is True
> > 2. Django's own login() seems to work, as request.user is set,
> > request.session is set etc.
> > 3. After the HttpResponseRedirect, request.user is AnonymousUser
> >
> > This has happened twice now, with different alternate auth backends. I
> can't
> > get rid of Django 1.3 before this is fixed...
> >
> > In one project I can call the next view directly (with render) and it
> Just
> > Works. In the current project, the next view contains a form, and the
> > "login" doesn't survive the POST.
> >
> > What am I missing? See also the non-solution in
> >
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
> >
> >
> > HM
> >
> > --
> > 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.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com
> .
> > 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CADTRxJO%2BwGM0GtyECQiNEAQFJq-nqSQEn5vefPGU6oJx%3DJS8PA%40mail.gmail.com
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrrdiG8nf9LJ1DrHLskBUerG2U3xHwyjDjLDSqJ7_TDRDyA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Sergiy Khohlov
 Take a look  at :
if form.is_valid():
#django.contrib.auth.login
Login(request, form.get_user())
str = reverse('cm_base.views.index')
return HttpResponseRedirect(str)
else:
# Their password / email combination must have been incorrect
pass

you  are verifying fields only. No more. And invalid creadentials (
correct for form) are  never go to else  block
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Mon, Oct 14, 2013 at 4:01 PM, Sergiy Khohlov <skhoh...@gmail.com> wrote:
> I have no idea why are you writing this code  by yourself ?
>  This  is already done  !
>  Take a look at
> https://github.com/django/django/blob/master/django/contrib/auth/views.py
>
>  login function is already done  and you can  use it .  Have no sense
> to write it by yourself.
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa <hanne@gmail.com> wrote:
>> I can't get logging in with alternate auth backends to work with Django 1.4
>> or newer.
>>
>> Basically:
>>
>> 1. authenticate() works. request.user.is_authenticated() is True
>> 2. Django's own login() seems to work, as request.user is set,
>> request.session is set etc.
>> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>>
>> This has happened twice now, with different alternate auth backends. I can't
>> get rid of Django 1.3 before this is fixed...
>>
>> In one project I can call the next view directly (with render) and it Just
>> Works. In the current project, the next view contains a form, and the
>> "login" doesn't survive the POST.
>>
>> What am I missing? See also the non-solution in
>> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>>
>>
>> HM
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJOnf8EkaR6tU5YMcKQ64GNOrHP7ShGKy2s4Wo6%3Dq1WU%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Sergiy Khohlov
I have no idea why are you writing this code  by yourself ?
 This  is already done  !
 Take a look at
https://github.com/django/django/blob/master/django/contrib/auth/views.py

 login function is already done  and you can  use it .  Have no sense
to write it by yourself.
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Mon, Oct 14, 2013 at 3:52 PM, Hanne Moa <hanne@gmail.com> wrote:
> I can't get logging in with alternate auth backends to work with Django 1.4
> or newer.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
>
> In one project I can call the next view directly (with render) and it Just
> Works. In the current project, the next view contains a form, and the
> "login" doesn't survive the POST.
>
> What am I missing? See also the non-solution in
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>
>
> HM
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJO%2BwGM0GtyECQiNEAQFJq-nqSQEn5vefPGU6oJx%3DJS8PA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-10-14 Thread Hanne Moa
I can't get logging in with alternate auth backends to work with Django 1.4
or newer.

Basically:

1. authenticate() works. request.user.is_authenticated() is True
2. Django's own login() seems to work, as request.user is set,
request.session is set etc.
3. After the HttpResponseRedirect, request.user is AnonymousUser

This has happened twice now, with different alternate auth backends. I
can't get rid of Django 1.3 before this is fixed...

In one project I can call the next view directly (with render) and it Just
Works. In the current project, the next view contains a form, and the
"login" doesn't survive the POST.

What am I missing? See also the non-solution in
http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect


HM

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACQ%3DrreSearLz5zZyu1yZWnAx_CrSOW7u0f%3DnPdVHMMOX4DOhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django 1.4 Form Wizard and browser back button document expired

2013-10-02 Thread Laura Morgan
Hi,

Working on a 3 step process, using a SessionWizardView class in Django 1.4 
Form wizard.  In IE (mostly, although have seen in other browsers), If user 
hits browser back button instead of the form PREV button, in some cases it 
gives "Document expired".  This probably isn't a wizard thing, but just 
wondering if anyone has dealt with this.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/857db7d2-c617-4e01-bf4c-a9261543358b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Query executed two times in database (django 1.4, oracle 11g)

2013-09-08 Thread Germán
I'm not familiar with caching internals but perhaps the fact that you are using 
`raw` has something to do with your problem?

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Query executed two times in database (django 1.4, oracle 11g)

2013-09-06 Thread bikeridercz
Dear colleagues,

I'm facing a problem probably related to caching infrastructure in DJango. 
Documentation says that data are fetched from DB once a then readed from 
cache.

However, my results are different. Query is executed two times. On my 
opinion the first fetch should be enough.

Here is a record from my debug log:

[06/Sep/2013 08:35:11] "GET /mvpn/waves/OSCAR_MVPN/ HTTP/1.1" 200 2316
DEBUG (11.092) select /*+ first_rows */rownum id, t.* from 
ngin_mvpn_wave_cdr_sum t where t.wave_id=:arg0 order by vpn_name; 
args=[u'OSCAR_MVPN'] 11.092076 select /*+ first_rows */rownum id, t.* 
from ngin_mvpn_wave_cdr_sum t where t.wave_id=:arg0 order by vpn_name 
[u'OSCAR_MVPN']
DEBUG (10.353) select /*+ first_rows */rownum id, t.* from 
ngin_mvpn_wave_cdr_sum t where t.wave_id=:arg0 order by vpn_name; 
args=[u'OSCAR_MVPN'] 10.352256 select /*+ first_rows */rownum id, t.* 
from ngin_mvpn_wave_cdr_sum t where t.wave_id=:arg0 order by vpn_name 
[u'OSCAR_MVPN']
[06/Sep/2013 08:35:35] "GET /mvpn/waves/OSCAR_MVPN/cdr/ HTTP/1.1" 200 19515


The problem is, that one execution takes 11 seconds what is acceptable 
result for business. However 20s is not. Query was already optimized - huge 
number of records from several tables is processed.

What I'm doing on view level:

...

mvpn_cdr = MVPN_WAVE_CDR_SUM.objects.raw('select /*+ first_rows */rownum 
id, t.* from ngin_mvpn_wave_cdr_sum t where t.wave_id=%s order by 
vpn_name', [wave_id])

... 

for i in mvpn_cdr:

count_moc_onnet = count_moc_onnet + i.count_moc_onnet

...

return render_to_response('ngin/mvpn_wave_cdr_sum.html', {'resultset': 
mvpn_cdr}, context_instance=c)


So, I think that "filter" method should fetch data from DB and put it into 
QuerySet cache. Further use of data should be taken from a cache.

Yes, It's fact that I was not setting any cache configuration before.

Please help or explain what I'm doing wrong.

Radim.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: handling FileField and FileSystemStorage in WizardView - Django 1.4

2013-08-07 Thread pravasi

On Tuesday, 29 January 2013 02:12:38 UTC-6, devver wrote:
>
> I created a form wizard of 6 steps, 
> in step sixth, have filefield for uploading docfile1
>
> django docs is poor on this topic, google does not help.
>
>
> my code working ok, but how handle filefield.
>
> need example, thanks
>
>
> forms.py
>
> class Step6(forms.Form):
>
>  docfile1 = forms.FileField(required=False)
>
>
> view.py
>
>
>1. class RegInfo(SessionWizardView):
>2. template_name = 'gest/wizard_form.html'
>3. file_storage = FileSystemStorage(location=os.path.join(settings.
>MEDIA_ROOT, 'docs'))
>4.  
>5. def get_context_data(self, form, **kwargs):
>6. context = super(RegInfo, self).get_context_data(form,
> **kwargs)
>7.
>8. if self.steps.current == 'six':
>9. print 'step 6'
>10.
>11. return context
>12.  
>13. def done(self, form_list, **kwargs):
>14. dati = self.get_all_cleaned_data()
>15.  
>16. s = Info()
>17. s.tec = self.request.user
>18. s.dataso = dati['dataso']
>19.
>20. s.docfile1 = 
>21.
>22. s.save()
>23.  
>24. return render_to_response('gest/done.html', {
>25. 'form_data': [form.cleaned_data for form in form_list],
>26. })
>27.  
>28. 
>
> docfile1= self.request.FILES['-docfile1']
> s.docfile1 = docfile1
>
Note that there is a prefix for the  request.FILES key which is the 'step' 
name defined for the form.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Project template for django 1.4+

2013-07-20 Thread Allisson
Here: https://github.com/allisson/django-project-template

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Mike Dewhirst

On 16/07/2013 9:59pm, Robert Jonathan Šimon wrote:

I have one question what must be in wsgi.py?


This is mine ... which works for Django 1.5

from __future__ import unicode_literals
# -*- coding: utf-8 -*-
import os
import sys
from django.core.wsgi import get_wsgi_application

project = "xxx"
srvroot = "/var/www"
site_root = os.path.join(srvroot, project)

if site_root not in sys.path:
sys.path.insert(0, site_root)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", 
"{0}.settings".format(project))

os.environ.setdefault("PYTHON_EGG_CACHE", site_root)

application = get_wsgi_application()

# assumes /var/www/{project}/{project}/settings.py




Dne úterý, 16. Ä ervence 2013 1:11:48 UTC+2 maiquel napsal(a):

How to set up django on Apache

I'm using django 1.4
and apache 2.4
and Python 2.7
My configuration is well

in httpd.conf

WSGIScriptAlias ​​/ C :/ xampp / htdocs / My_blog / My_blog /
wsgi.py
WSGIPythonPath / C :/ xampp / htdocs / My_blog /



Order deny, allow
Allow from all



Does anyone know what is wrong?

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Lukas Nemec

Take a look here:

https://nemec.lu/en/how-to/~django-nginx-uwsgi-ssl

It is not apache, but nginx + uwsgi app + django

wsgi.py is generated automatically by manage.py startproject

example is here:
https://github.com/lunemec/wysiwyg/blob/master/wysiwyg/wsgi.py

Note: this is the app that runs under the hood of http://nemec.lu
so it is working...



On 07/16/2013 01:59 PM, Robert Jonathan Šimon wrote:

I have one question what must be in wsgi.py?

Dne úterý, 16. července 2013 1:11:48 UTC+2 maiquel napsal(a):

How to set up django on Apache

I'm using django 1.4
and apache 2.4
and Python 2.7
My configuration is well

in httpd.conf

WSGIScriptAlias ​​/ C :/ xampp / htdocs / My_blog / My_blog / wsgi.py
WSGIPythonPath / C :/ xampp / htdocs / My_blog /



Order deny, allow
Allow from all



Does anyone know what is wrong?

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Robert Jonathan Šimon
I have one question what must be in wsgi.py?

Dne úterý, 16. července 2013 1:11:48 UTC+2 maiquel napsal(a):
>
> How to set up django on Apache
>
> I'm using django 1.4
> and apache 2.4
> and Python 2.7
> My configuration is well
>
> in httpd.conf
>
> WSGIScriptAlias ​​/ C :/ xampp / htdocs / My_blog / My_blog / wsgi.py
> WSGIPythonPath / C :/ xampp / htdocs / My_blog /
>
> 
> 
> Order deny, allow
> Allow from all
> 
> 
>
> Does anyone know what is wrong?
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-16 Thread Mike Dewhirst

On 16/07/2013 12:25pm, carlos wrote:

where is the error ??


On Mon, Jul 15, 2013 at 5:11 PM, maiquel <maiquelknech...@gmail.com
<mailto:maiquelknech...@gmail.com>> wrote:

How to set up django on Apache

    I'm using django 1.4
and apache 2.4
and Python 2.7
My configuration is well

in httpd.conf



There are spaces everywhere on the next 2 lines and I don't know what 
Apache might think of them. Check below for a working config.



WSGIScriptAlias / C :/ xampp / htdocs / My_blog / My_blog / wsgi.py
WSGIPythonPath / C :/ xampp / htdocs / My_blog /



Order deny, allow
Allow from all



Does anyone know what is wrong?





 DocumentRoot /var/www/xxx/htdocs/
 ServerName xxx.xxx.com.au
 ServerAdmin webmas...@xxx.com.au

 HostnameLookups Off
 UseCanonicalName Off

 ErrorLog ${APACHE_LOG_DIR}/xxx-error.log
 CustomLog ${APACHE_LOG_DIR}/xxx-access.log combined

 Alias /robots.txt /var/www/static/xxx/robots/robots.txt
 Alias /favicon.ico /var/www/static/xxx/img/xxx.ico

 # lock the public out
 
  AllowOverride None
  Order deny,allow
  Deny from all
 

 # serve uploaded media from here
 
  AllowOverride None
  Order deny,allow
  Allow from all
 

 # serve static stuff from here
 
  AllowOverride None
  Order deny,allow
  Allow from all
 

 
  Alias /media/ /var/www/media/xxx/
  Alias /static/ /var/www/static/xxx/
  #Alias /tiny_mce/ /var/www/static/xxx/js/tiny_mce/
  Alias /jquery/ /var/www/static/xxx/js/jquery/
 

 # now let the public access anything here because it holds nothing
 
  AllowOverride None
  Order deny,allow
  Allow from all
 

 
   WSGIScriptAlias / /var/www/xxx/xxx/xxx.wsgi
   
 Order deny,allow
 Allow from all
   
 




--
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Python 2.7 + Django 1.4 + apache 2.4

2013-07-15 Thread carlos
where is the error ??


On Mon, Jul 15, 2013 at 5:11 PM, maiquel <maiquelknech...@gmail.com> wrote:

> How to set up django on Apache
>
> I'm using django 1.4
> and apache 2.4
> and Python 2.7
> My configuration is well
>
> in httpd.conf
>
> WSGIScriptAlias / C :/ xampp / htdocs / My_blog / My_blog / wsgi.py
> WSGIPythonPath / C :/ xampp / htdocs / My_blog /
>
> 
> 
> Order deny, allow
> Allow from all
> 
> 
>
> Does anyone know what is wrong?
>
> --
> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Python 2.7 + Django 1.4 + apache 2.4

2013-07-15 Thread maiquel
How to set up django on Apache

I'm using django 1.4
and apache 2.4
and Python 2.7
My configuration is well

in httpd.conf

WSGIScriptAlias / C :/ xampp / htdocs / My_blog / My_blog / wsgi.py
WSGIPythonPath / C :/ xampp / htdocs / My_blog /



Order deny, allow
Allow from all



Does anyone know what is wrong?

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.4 tutorial part 1 seems broken at the superuser creation stage.

2013-06-17 Thread Ed
Thank you very much, Tom, for pointing that out.

I had no idea django was looking for that environment variable. Following 
your direction, I checked, and discover that they are all indeed default to 
"undefined". I'm using OpenBSD 5.3 on macppc, which explains why they were 
not set, as opposed to on Linux.

$ python -m locale
Locale aliasing:

Locale defaults as determined by getdefaultlocale():

Language:  (undefined)
Encoding:  (undefined)

Locale settings on startup:

LC_NUMERIC ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_MESSAGES ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_MONETARY ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_COLLATE ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_CTYPE ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_TIME ...
   Language:  (undefined)
   Encoding:  (undefined)


Locale settings after calling resetlocale():

LC_NUMERIC ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_MESSAGES ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_MONETARY ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_COLLATE ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_CTYPE ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_TIME ...
   Language:  (undefined)
   Encoding:  (undefined)


Locale settings after calling setlocale(LC_ALL, ""):

LC_NUMERIC ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_MESSAGES ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_MONETARY ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_COLLATE ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_CTYPE ...
   Language:  (undefined)
   Encoding:  (undefined)

LC_TIME ...
   Language:  (undefined)
   Encoding:  (undefined)


Number formatting:

123456789 is 123456789
3.14 is 3.14
$ 




On Monday, 17 June 2013 04:02:43 UTC-7, Tom Evans wrote:
>
> On Sun, Jun 16, 2013 at 8:06 AM, Ed  
> wrote: 
> > Hello Dear Django Group. 
> > 
> > My first day with Django, I just got it installed on my computer, and am 
> > trying to follow along with the first tutorial: 
> > https://docs.djangoproject.com/en/1.4/intro/tutorial01/ 
> > 
> > I have Django's development server up, and I'm able to see the "It 
> worked!" 
> > Django welcome page. Where I ran into the dead end is at the following 
> > section: 
> > 
> > "The syncdb command looks at the INSTALLED_APPS setting and creates any 
> > necessary database tables according to the database settings in your 
> > settings.py file. You’ll see a message for each database table it 
> creates, 
> > and you’ll get a prompt asking you if you’d like to create a superuser 
> > account for the authentication system. Go ahead and do that." 
> > 
> > Up to this point, I've followed the tutorial line by line. However, 
> after I 
> > ran the command "python manage.py syncdb", I got the error message 
> below, 
> > and it seems to be an internal error to Django. Has anyone else 
> encountered 
> > this issue, and how did you resolve it? Any feedback or insight is 
> > appreciated. Thank you! 
> > 
> > 
> > $ python manage.py syncdb 
> > Creating tables ... 
> > Creating table auth_permission 
> > Creating table auth_group_permissions 
> > Creating table auth_group 
> > Creating table auth_user_user_permissions 
> > Creating table auth_user_groups 
> > Creating table auth_user 
> > Creating table django_content_type 
> > Creating table django_session 
> > Creating table django_site 
> > 
> > You just installed Django's auth system, which means you don't have any 
> > superusers defined. 
> > Would you like to create one now? (yes/no): yes 
> > Traceback (most recent call last): 
> >   File "manage.py", line 10, in  
> > execute_from_command_line(sys.argv) 
> >   File 
> > 
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
>
> > line 443, in execute_from_command_line 
> > utility.execute() 
> >   File 
> > 
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
>
> > line 382, in execute 
> > self.fetch_command(subcommand).run_from_argv(self.argv) 
> >   File 
> > "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> > line 196, in run_from_argv 
> > self.execute(*args, **options.__dict__) 
> >   File 
> > "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> > line 232, in execute 
> > output = self.handle(*args, **options) 
> >   File 
> > "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> > line 371, in handle 
> > return self.handle_noargs(**options) 
> >   File 
> > 
> 

Re: Django 1.4 tutorial part 1 seems broken at the superuser creation stage.

2013-06-17 Thread Tom Evans
On Sun, Jun 16, 2013 at 8:06 AM, Ed  wrote:
> Hello Dear Django Group.
>
> My first day with Django, I just got it installed on my computer, and am
> trying to follow along with the first tutorial:
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/
>
> I have Django's development server up, and I'm able to see the "It worked!"
> Django welcome page. Where I ran into the dead end is at the following
> section:
>
> "The syncdb command looks at the INSTALLED_APPS setting and creates any
> necessary database tables according to the database settings in your
> settings.py file. You’ll see a message for each database table it creates,
> and you’ll get a prompt asking you if you’d like to create a superuser
> account for the authentication system. Go ahead and do that."
>
> Up to this point, I've followed the tutorial line by line. However, after I
> ran the command "python manage.py syncdb", I got the error message below,
> and it seems to be an internal error to Django. Has anyone else encountered
> this issue, and how did you resolve it? Any feedback or insight is
> appreciated. Thank you!
>
>
> $ python manage.py syncdb
> Creating tables ...
> Creating table auth_permission
> Creating table auth_group_permissions
> Creating table auth_group
> Creating table auth_user_user_permissions
> Creating table auth_user_groups
> Creating table auth_user
> Creating table django_content_type
> Creating table django_session
> Creating table django_site
>
> You just installed Django's auth system, which means you don't have any
> superusers defined.
> Would you like to create one now? (yes/no): yes
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 443, in execute_from_command_line
> utility.execute()
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 196, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 232, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 371, in handle
> return self.handle_noargs(**options)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",
> line 110, in handle_noargs
> emit_post_sync_signal(created_models, verbosity, interactive, db)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/sql.py", line
> 189, in emit_post_sync_signal
> interactive=interactive, db=db)
>   File
> "/usr/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line
> 172, in send
> response = receiver(signal=self, sender=sender, **named)
>   File
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
> line 73, in create_superuser
> call_command("createsuperuser", interactive=True, database=db)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 150, in call_command
> return klass.execute(*args, **defaults)
>   File
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py",
> line 232, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
> line 70, in handle
> default_username = get_default_username()
>   File
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
> line 105, in get_default_username
> default_username = get_system_username()
>   File
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
> line 85, in get_system_username
> return getpass.getuser().decode(locale.getdefaultlocale()[1])
> TypeError: decode() argument 1 must be string, not None
> $
>

Look at the final, breaking, line of code in the stack trace:

return getpass.getuser().decode(locale.getdefaultlocale()[1])

The error says that the argument to decode() is None. The argument to
decode() is the 2nd value returned by locale.getdefaultlocale(), which
returns a 2-tuple of (locale, charset), which is determined (on linux)
by examining the value of the environment variable LANG.

If LANG is unset or empty (or the "C" locale) then these values are
undefined. Django relies on these values being defined to understand
input that is given to it.

Set a proper LANG in your environment. Use "python -m locale" to check
what python sees it as. Common values for LANG are like "en_GB.UTF-8"
or "pt_BR.UTF-8".

Cheers

Tom

-- 
You received this message because you are subscribed to the Google 

Re: Django 1.4 tutorial part 1 seems broken at the superuser creation stage.

2013-06-16 Thread gilberto dos santos alves
please see your locale environment var. what is your os (linux, windows, 
mac) please post your files. how you installed your django?

Em domingo, 16 de junho de 2013 04h06min32s UTC-3, Ed escreveu:
>
> Hello Dear Django Group.
>
> My first day with Django, I just got it installed on my computer, and am 
> trying to follow along with the first tutorial: 
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/
>
> I have Django's development server up, and I'm able to see the "It 
> worked!" Django welcome page. Where I ran into the dead end is at the 
> following section:
>
> "The 
> syncdb
>  command looks at the 
> INSTALLED_APPS
>  setting and creates any necessary database tables according to the 
> database settings in your settings.py file. You’ll see a message for each 
> database table it creates, and you’ll get a prompt asking you if you’d like 
> to create a superuser account for the authentication system. Go ahead and 
> do that."
>
> Up to this point, I've followed the tutorial line by line. However, after 
> I ran the command "python manage.py syncdb", I got the error message below, 
> and it seems to be an internal error to Django. Has anyone else encountered 
> this issue, and how did you resolve it? Any feedback or insight is 
> appreciated. Thank you!
>
>
> $ python manage.py syncdb 
>  
> Creating tables ...
> Creating table auth_permission
> Creating table auth_group_permissions
> Creating table auth_group
> Creating table auth_user_user_permissions
> Creating table auth_user_groups
> Creating table auth_user
> Creating table django_content_type
> Creating table django_session
> Creating table django_site
>
> You just installed Django's auth system, which means you don't have any 
> superusers defined.
> Would you like to create one now? (yes/no): yes
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
> line 443, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
> line 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> line 196, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> line 232, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> line 371, in handle
> return self.handle_noargs(**options)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",
>  
> line 110, in handle_noargs
> emit_post_sync_signal(created_models, verbosity, interactive, db)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/sql.py", 
> line 189, in emit_post_sync_signal
> interactive=interactive, db=db)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", 
> line 172, in send
> response = receiver(signal=self, sender=sender, **named)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>  
> line 73, in create_superuser
> call_command("createsuperuser", interactive=True, database=db)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
> line 150, in call_command
> return klass.execute(*args, **defaults)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
> line 232, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>  
> line 70, in handle
> default_username = get_default_username()
>   File 
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>  
> line 105, in get_default_username
> default_username = get_system_username()
>   File 
> "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>  
> line 85, in get_system_username
> return getpass.getuser().decode(locale.getdefaultlocale()[1])
> TypeError: decode() argument 1 must be string, not None
> $ 
>
>
>
>

-- 
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.
For more options, 

Django 1.4 tutorial part 1 seems broken at the superuser creation stage.

2013-06-16 Thread Ed
Hello Dear Django Group.

My first day with Django, I just got it installed on my computer, and am 
trying to follow along with the first 
tutorial: https://docs.djangoproject.com/en/1.4/intro/tutorial01/

I have Django's development server up, and I'm able to see the "It worked!" 
Django welcome page. Where I ran into the dead end is at the following 
section:

"The 
syncdb
 command looks at the 
INSTALLED_APPS
 setting and creates any necessary database tables according to the 
database settings in your settings.py file. You’ll see a message for each 
database table it creates, and you’ll get a prompt asking you if you’d like 
to create a superuser account for the authentication system. Go ahead and 
do that."

Up to this point, I've followed the tutorial line by line. However, after I 
ran the command "python manage.py syncdb", I got the error message below, 
and it seems to be an internal error to Django. Has anyone else encountered 
this issue, and how did you resolve it? Any feedback or insight is 
appreciated. Thank you!


$ python manage.py syncdb   
   
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any 
superusers defined.
Would you like to create one now? (yes/no): yes
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
line 443, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
line 371, in handle
return self.handle_noargs(**options)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",
 
line 110, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/sql.py", 
line 189, in emit_post_sync_signal
interactive=interactive, db=db)
  File 
"/usr/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", 
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File 
"/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
 
line 73, in create_superuser
call_command("createsuperuser", interactive=True, database=db)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", 
line 150, in call_command
return klass.execute(*args, **defaults)
  File 
"/usr/local/lib/python2.7/site-packages/django/core/management/base.py", 
line 232, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
 
line 70, in handle
default_username = get_default_username()
  File 
"/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
 
line 105, in get_default_username
default_username = get_system_username()
  File 
"/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
 
line 85, in get_system_username
return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None
$ 



-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.4 - how to display a success message on form save

2013-04-04 Thread Zach Mance
Hi Kurtis,

I saw your SO post, and I'm trying trigger success messages from my CBV's, 
and I'm just wondering how your "MessageMixin" methods work with your 
CBV's. For example, where/how does the form_valid() get called to pass the 
success_message from the CBV's. 

Also, will this work with 1.4? 


On Tuesday, June 26, 2012 10:31:17 AM UTC-5, Kurtis wrote:
>
> We do it all over our site. I use class-based views but you can checkout 
> my "MessageMixin". I have the code on this stackoverflow page:
>
>
> http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview/10903943#10903943
>
> It will show up wherever you send the user to next, as long as your 
> template is coded to display the message.
>

-- 
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 1.5 - admin update user, got message "User with this Username already exists" (Django 1.4 excepted update of the user)

2013-03-19 Thread K van Man
 

*Django 1.5 - admin update user, got message "User with this Username 
already exists" (Django 1.4 excepted update of the user)*

Created a simple polls app, and using the django.contrib.auth in 
INSTALLED_APPS 

When an attempt is made to update a user (in the admin frontend) this 
message is produced: 'User with this Username already exists.'

The same example is working fine (update the user without warnings) in 
Django 1.4

-- 
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: Suggestion for using distinct on django 1.4+ in your unit tests?

2013-03-06 Thread Brad Pitcher
I believe sqlite supports "distinct" just not "distinct on". I have always
managed to find workarounds using "distinct" anywhere I formerly used
"distinct on".
On Mar 6, 2013 7:01 AM, "Toran Billups" <tor...@gmail.com> wrote:

> I recently upgraded to django 1.4 and found that my "distinct" queries
> don't work anymore in my test code because sqlite doesn't support it -how
> is everyone using this for integration testing?
>
> Thank you in advance
>
> --
> 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.




Suggestion for using distinct on django 1.4+ in your unit tests?

2013-03-06 Thread Toran Billups
I recently upgraded to django 1.4 and found that my "distinct" queries 
don't work anymore in my test code because sqlite doesn't support it -how 
is everyone using this for integration testing? 

Thank you in advance

-- 
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: HTML5 Offline apps with Django 1.4

2013-02-28 Thread Russell Keith-Magee
Hi Ranjith,

Perhaps I've confused things here -- when you're serving offline HTML5, you
need to serve (at least) 2 pages -- a page with html, and a *completely
separate* second page containing the manifest. The manifest file has a
content type of text/cache-manifest; your HTML is served with a normal
text/html content type.

>From what you describe, it sounds like you're just serving the HTML as
text/cache-manifest.

Yours,
Russ Magee %-)

On Tue, Feb 26, 2013 at 10:34 AM, Ranjith Chaz  wrote:

> Thanks for the reply, Russell. I had tried it already. What I get when I
> do this is, the html source instead of the web page. That is, the complete
> html code gets printed out in the browser and it happens in all browsers
> irrespective of mobile, desktop.
>
>
> On Thursday, February 21, 2013 1:08:16 PM UTC+5:30, Ranjith Chaz wrote:
>>
>> Trying to implement *offline** *feature of *HTML5*.  Deployed in *
>> apache2.2* with mod_wsgi plugin.
>> It works as expected (i.e., loads the cached page when offline) in
>> chrome, Opera (using window.openDatabase) and other desktop browsers.
>> However it doesn't work in Android 2.x, iPhone default browsers. Strangely,
>> it works with Android 4.0 browser!!
>> Here is the code:
>>
>> *HTML*
>>
>> 
>> 
>>
>>   
>>   MyHomeStuff
>>   > >
>>   
>>
>>
>>  .
>>
>> 
>>
>>
>> *Apache conf\mime.types**text/cache-manifest manifest*
>>
>> *
>> *
>>
>> *\Python27\Lib\mimetypes.py*
>> Added *'.manifest': 'text/cache-manifest'*, into *types_map *dict
>>
>> (With the above addition to mimetypes.py, it started working for android 4.0)
>>
>>
>> *cache.manifest*CACHE MANIFEST
>> CACHE:index.htmlMyHomeStuff.js
>>
>>
>> *views.py:*
>>
>> def offlineApp(request):
>> t = get_template('index.html')
>> html = 
>> t.render(Context({'MEDIA_URL':**'http://myDomain.com/site_**media/ 
>> '}))
>> return HttpResponse(html)
>>
>>
>> *Is it required to use any specific module/middleware to handle 
>> text/manifest in django ?*
>>
>> Any help is appreciated. Already spent a lot of time on this!
>>
>>
>>  --
> 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: HTML5 Offline apps with Django 1.4

2013-02-25 Thread Ranjith Chaz
Thanks for the reply, Russell. I had tried it already. What I get when I do 
this is, the html source instead of the web page. That is, the complete 
html code gets printed out in the browser and it happens in all browsers 
irrespective of mobile, desktop.


On Thursday, February 21, 2013 1:08:16 PM UTC+5:30, Ranjith Chaz wrote:
>
> Trying to implement *offline** *feature of *HTML5*.  Deployed in *
> apache2.2* with mod_wsgi plugin.
> It works as expected (i.e., loads the cached page when offline) in chrome, 
> Opera (using window.openDatabase) and other desktop browsers. However it 
> doesn't work in Android 2.x, iPhone default browsers. Strangely, it works 
> with Android 4.0 browser!!
> Here is the code:
>
> *HTML*
>
> 
> 
>
> 
>   MyHomeStuff  
>>
>   
>
>
>  .
>
> 
>
>
> *Apache conf\mime.types**text/cache-manifest manifest*
>
> *
> *
>
> *\Python27\Lib\mimetypes.py*
> Added *'.manifest': 'text/cache-manifest'*, into *types_map *dict
>
> (With the above addition to mimetypes.py, it started working for android 4.0)
>
>
> *cache.manifest*CACHE MANIFEST
> CACHE:index.htmlMyHomeStuff.js
>
>
> *views.py:*
>
> def offlineApp(request):
> t = get_template('index.html')
> html = t.render(Context({'MEDIA_URL':'http://myDomain.com/site_media/'}))
> return HttpResponse(html)
>
>
> *Is it required to use any specific module/middleware to handle text/manifest 
> in django ?*
>
> Any help is appreciated. Already spent a lot of time on this!
>
>
>

-- 
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: HTML5 Offline apps with Django 1.4

2013-02-21 Thread Russell Keith-Magee
On Thu, Feb 21, 2013 at 3:38 PM, Ranjith Chaz  wrote:

> Trying to implement *offline** *feature of *HTML5*.  Deployed in *
> apache2.2* with mod_wsgi plugin.
> It works as expected (i.e., loads the cached page when offline) in chrome,
> Opera (using window.openDatabase) and other desktop browsers. However it
> doesn't work in Android 2.x, iPhone default browsers. Strangely, it works
> with Android 4.0 browser!!
> Here is the code:
>
> *views.py:*
>
> def offlineApp(request):
> t = get_template('index.html')
> html = t.render(Context({'MEDIA_URL':'http://myDomain.com/site_media/'}))
> return HttpResponse(html)
>
>
> *Is it required to use any specific module/middleware to handle text/manifest 
> in django ?*
>
> No - you just have to return a response that sets the content type:

return HttpResponse(html, content_type='text/cache-manifest')

Yours,
Russ Magee %-)

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




HTML5 Offline apps with Django 1.4

2013-02-21 Thread Ranjith Chaz
Trying to implement *offline** *feature of *HTML5*.  Deployed in 
*apache2.2*with 
mod_wsgi plugin.
It works as expected (i.e., loads the cached page when offline) in chrome, 
Opera (using window.openDatabase) and other desktop browsers. However it 
doesn't work in Android 2.x, iPhone default browsers. Strangely, it works 
with Android 4.0 browser!!
Here is the code:

*HTML*



   

  MyHomeStuff  
  
  
   
   
 .
   



*Apache conf\mime.types**text/cache-manifest manifest*

*
*

*\Python27\Lib\mimetypes.py*
Added *'.manifest': 'text/cache-manifest'*, into *types_map *dict

(With the above addition to mimetypes.py, it started working for android 4.0)


*cache.manifest*CACHE MANIFEST
CACHE:index.htmlMyHomeStuff.js


*views.py:*

def offlineApp(request):
t = get_template('index.html')
html = t.render(Context({'MEDIA_URL':'http://myDomain.com/site_media/'}))
return HttpResponse(html)


*Is it required to use any specific module/middleware to handle text/manifest 
in django ?*

Any help is appreciated. Already spent a lot of time on this!


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




handling FileField and FileSystemStorage in WizardView - Django 1.4

2013-01-29 Thread devver


I created a form wizard of 6 steps, 
in step sixth, have filefield for uploading docfile1

django docs is poor on this topic, google does not help.


my code working ok, but how handle filefield.

need example, thanks


forms.py

class Step6(forms.Form):

 docfile1 = forms.FileField(required=False)


view.py


   1. class RegInfo(SessionWizardView):
   2. template_name = 'gest/wizard_form.html'
   3. file_storage = FileSystemStorage(location=os.path.join(settings.
   MEDIA_ROOT, 'docs'))
   4.  
   5. def get_context_data(self, form, **kwargs):
   6. context = super(RegInfo, self).get_context_data(form, **kwargs
   )
   7.
   8. if self.steps.current == 'six':
   9. print 'step 6'
   10.
   11. return context
   12.  
   13. def done(self, form_list, **kwargs):
   14. dati = self.get_all_cleaned_data()
   15.  
   16. s = Info()
   17. s.tec = self.request.user
   18. s.dataso = dati['dataso']
   19.
   20. s.docfile1 = 
   21.
   22. s.save()
   23.  
   24. return render_to_response('gest/done.html', {
   25. 'form_data': [form.cleaned_data for form in form_list],
   26. })
   27.  
   28. 
   

-- 
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.4 Development Workflow Using Static Files

2012-12-26 Thread Bill Freeman
On Wed, Dec 26, 2012 at 6:06 AM, huw_at1  wrote:

> Thanks for the reply. I realised a few moments ago that I can use a
> relative STATIC_URL rather than an absolute one so now I just have
> '/static/' set as the value which works well.
>
> Many thanks
>
> RESOLVED
>
>
> On Wednesday, 26 December 2012 00:53:42 UTC, אברהם סרור wrote:
>
>> Maybe you can just upload the files directly to the collect static folder
>> on the server
>>
>> In any case maybe you want them under version control, so I guess you
>> could just automate all these steps with fabric
>> On Dec 26, 2012 1:00 AM, "huw_at1"  wrote:
>>
>>> Hi again,
>>>
>>> Another quick question. I'm still getting used to 1.4 and I've been
>>> setting up a remote static file service for the production deployment of my
>>> web app. This works just great however it seems a little cumbersome when
>>> developing if I want to add fresh image content I have to add it to the
>>> project locally, commit and push the changes, deploy to production and
>>> collect the static files there before the image is available to the
>>> development server...This seems like a very round about way of developing -
>>> I must be missing something here although I do not know what? Should I
>>> modify the setting.py to change the STATIC_URL value dependent on whether
>>> the server is production or development or is there any smarter way?
>>>
>>> As ever any advice is much appreciated.
>>>
>>> Huw_at1
>>>
>>>
>>> You can also use the trick:

try:
from local_settings import *
except:
pass

To have a different value in STATIC_URL for your testing environment.
(Obviously, you keep local_settings.py out of revision control.)

Bill

-- 
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: Django 1.4 manage.py cannot find settings

2012-12-26 Thread Bill Freeman
On Tue, Dec 25, 2012 at 8:22 AM, huw_at1  wrote:

> Hi,
>
> This has probably been asked a million times before so apologies. I'm new
> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to
> perform a simple import from within my shell:
>
> from django.contrib.sites.models import Site
>
> However I am constantly getting the problem that my settings are not being
> found:
>
> raise ImportError("Could not import settings '%s' (Is it on
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'test.test.settings' (Is it on
> sys.path?): No module named test.settings
>
> In the past I would have thought that this was an issue as the project and
> the "app" had the same name although in the case of 1.4 the settings are
> placed in a directory with the same name as the project. I'm not sure what
> I should change to get this to work.
>
> Has this been seen before or any ideas?
>
> Many thanks
>
>
> The only shell from which you can perform this import is the one you reach
via:

python manage.py shell

If you just start python, such imports will not work.

Note, too, that the directory containing manage.py should be the current
directory at the time that python is started (as opposed to adding that
directory to sys.path.

You can do a lot of typing and get a bare python into a state from which it
can import Site, but it would be far more productive to teach your IDE to
start a shell as above for those times when you want to play like this.

Bill

-- 
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: Django 1.4 Development Workflow Using Static Files

2012-12-26 Thread huw_at1
Thanks for the reply. I realised a few moments ago that I can use a 
relative STATIC_URL rather than an absolute one so now I just have 
'/static/' set as the value which works well.

Many thanks

RESOLVED

On Wednesday, 26 December 2012 00:53:42 UTC, אברהם סרור wrote:
>
> Maybe you can just upload the files directly to the collect static folder 
> on the server
>
> In any case maybe you want them under version control, so I guess you 
> could just automate all these steps with fabric
> On Dec 26, 2012 1:00 AM, "huw_at1"  
> wrote:
>
>> Hi again,
>>
>> Another quick question. I'm still getting used to 1.4 and I've been 
>> setting up a remote static file service for the production deployment of my 
>> web app. This works just great however it seems a little cumbersome when 
>> developing if I want to add fresh image content I have to add it to the 
>> project locally, commit and push the changes, deploy to production and 
>> collect the static files there before the image is available to the 
>> development server...This seems like a very round about way of developing - 
>> I must be missing something here although I do not know what? Should I 
>> modify the setting.py to change the STATIC_URL value dependent on whether 
>> the server is production or development or is there any smarter way?
>>
>> As ever any advice is much appreciated.
>>
>> Huw_at1
>>
>> -- 
>> 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/-/SL1HBsWfETwJ.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BpNp4qTuVbgJ.
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 1.4 manage.py cannot find settings

2012-12-25 Thread Ryan Blunden
I would say stay away using PyCharm to manage your Django application until 
you're more experienced. Learn to manage your app purely through the 
command line first.

On Tuesday, December 25, 2012 9:28:15 AM UTC-8, Victor Rocha wrote:
>
> Your welcome! Merry Christmas
>
>
>
> On Tue, Dec 25, 2012 at 12:25 PM, huw_at1  > wrote:
>
>> Hiya - sorry yeah I pasted the wrong manage.py file initially. It should 
>> have been the test.settings manage.py.
>>
>> I figured it out partially anyway - I needed to change the project 
>> directory setting in the IDE as you said.
>>
>> Thanks for the help.
>>
>>
>> On Tuesday, December 25, 2012 5:14:03 PM UTC, Victor Rocha wrote:
>>
>>> I don't think I can be of more help. Hopefully someone with experience 
>>> with PyCharm can chime in.
>>> This is probably not what you want to hear but ditch windows, ditch 
>>> pycharm use windows and vim or at least gedit.
>>>
>>> One last comment, in your manage.py file i can see this 'pkadata.settings'; 
>>> i didnt see that directory when you showed me your file structure.
>>>
>>>
>>>
>>> On Tue, Dec 25, 2012 at 12:01 PM, huw_at1  wrote:
>>>
 pkadata.settings
>>>
>>>
>>>  -- 
>> 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/-/xbeOEaE7Ah4J.
>>
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FeHXglY42PAJ.
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 1.4 Development Workflow Using Static Files

2012-12-25 Thread Avraham Serour
Maybe you can just upload the files directly to the collect static folder
on the server

In any case maybe you want them under version control, so I guess you could
just automate all these steps with fabric
On Dec 26, 2012 1:00 AM, "huw_at1"  wrote:

> Hi again,
>
> Another quick question. I'm still getting used to 1.4 and I've been
> setting up a remote static file service for the production deployment of my
> web app. This works just great however it seems a little cumbersome when
> developing if I want to add fresh image content I have to add it to the
> project locally, commit and push the changes, deploy to production and
> collect the static files there before the image is available to the
> development server...This seems like a very round about way of developing -
> I must be missing something here although I do not know what? Should I
> modify the setting.py to change the STATIC_URL value dependent on whether
> the server is production or development or is there any smarter way?
>
> As ever any advice is much appreciated.
>
> Huw_at1
>
> --
> 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/-/SL1HBsWfETwJ.
> 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.



Django 1.4 Development Workflow Using Static Files

2012-12-25 Thread huw_at1
Hi again,

Another quick question. I'm still getting used to 1.4 and I've been setting 
up a remote static file service for the production deployment of my web 
app. This works just great however it seems a little cumbersome when 
developing if I want to add fresh image content I have to add it to the 
project locally, commit and push the changes, deploy to production and 
collect the static files there before the image is available to the 
development server...This seems like a very round about way of developing - 
I must be missing something here although I do not know what? Should I 
modify the setting.py to change the STATIC_URL value dependent on whether 
the server is production or development or is there any smarter way?

As ever any advice is much appreciated.

Huw_at1

-- 
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/-/SL1HBsWfETwJ.
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 1.4 manage.py cannot find settings

2012-12-25 Thread Victor Rocha
Would you please describe all you have to do to resolve it, in case someone
else stumbles upon the same issue?

Thank you,
Victor Rocha
RochApps 

On Tue, Dec 25, 2012 at 5:51 PM, huw_at1  wrote:

> [RESOLVED]
>
>
> On Tuesday, 25 December 2012 17:28:15 UTC, Victor Rocha wrote:
>
>> Your welcome! Merry Christmas
>>
>>
>>
>> On Tue, Dec 25, 2012 at 12:25 PM, huw_at1  wrote:
>>
>>> Hiya - sorry yeah I pasted the wrong manage.py file initially. It should
>>> have been the test.settings manage.py.
>>>
>>> I figured it out partially anyway - I needed to change the project
>>> directory setting in the IDE as you said.
>>>
>>> Thanks for the help.
>>>
>>>
>>> On Tuesday, December 25, 2012 5:14:03 PM UTC, Victor Rocha wrote:
>>>
 I don't think I can be of more help. Hopefully someone with experience
 with PyCharm can chime in.
 This is probably not what you want to hear but ditch windows, ditch
 pycharm use windows and vim or at least gedit.

 One last comment, in your manage.py file i can see this 'pkadata.settings';
 i didnt see that directory when you showed me your file structure.



 On Tue, Dec 25, 2012 at 12:01 PM, huw_at1  wrote:

> pkadata.settings


  --
>>> 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/-/**xbeOEaE7Ah4J
>>> .
>>>
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users...@**
>>> 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/QDMIerGSTp8J.
>
> 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: Django 1.4 manage.py cannot find settings

2012-12-25 Thread huw_at1
[RESOLVED]

On Tuesday, 25 December 2012 17:28:15 UTC, Victor Rocha wrote:
>
> Your welcome! Merry Christmas
>
>
>
> On Tue, Dec 25, 2012 at 12:25 PM, huw_at1  > wrote:
>
>> Hiya - sorry yeah I pasted the wrong manage.py file initially. It should 
>> have been the test.settings manage.py.
>>
>> I figured it out partially anyway - I needed to change the project 
>> directory setting in the IDE as you said.
>>
>> Thanks for the help.
>>
>>
>> On Tuesday, December 25, 2012 5:14:03 PM UTC, Victor Rocha wrote:
>>
>>> I don't think I can be of more help. Hopefully someone with experience 
>>> with PyCharm can chime in.
>>> This is probably not what you want to hear but ditch windows, ditch 
>>> pycharm use windows and vim or at least gedit.
>>>
>>> One last comment, in your manage.py file i can see this 'pkadata.settings'; 
>>> i didnt see that directory when you showed me your file structure.
>>>
>>>
>>>
>>> On Tue, Dec 25, 2012 at 12:01 PM, huw_at1  wrote:
>>>
 pkadata.settings
>>>
>>>
>>>  -- 
>> 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/-/xbeOEaE7Ah4J.
>>
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QDMIerGSTp8J.
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 1.4 manage.py cannot find settings

2012-12-25 Thread Victor Rocha
Your welcome! Merry Christmas



On Tue, Dec 25, 2012 at 12:25 PM, huw_at1  wrote:

> Hiya - sorry yeah I pasted the wrong manage.py file initially. It should
> have been the test.settings manage.py.
>
> I figured it out partially anyway - I needed to change the project
> directory setting in the IDE as you said.
>
> Thanks for the help.
>
>
> On Tuesday, December 25, 2012 5:14:03 PM UTC, Victor Rocha wrote:
>
>> I don't think I can be of more help. Hopefully someone with experience
>> with PyCharm can chime in.
>> This is probably not what you want to hear but ditch windows, ditch
>> pycharm use windows and vim or at least gedit.
>>
>> One last comment, in your manage.py file i can see this 'pkadata.settings';
>> i didnt see that directory when you showed me your file structure.
>>
>>
>>
>> On Tue, Dec 25, 2012 at 12:01 PM, huw_at1  wrote:
>>
>>> pkadata.settings
>>
>>
>>  --
> 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/-/xbeOEaE7Ah4J.
>
> 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: Django 1.4 manage.py cannot find settings

2012-12-25 Thread huw_at1
Hiya - sorry yeah I pasted the wrong manage.py file initially. It should 
have been the test.settings manage.py.

I figured it out partially anyway - I needed to change the project 
directory setting in the IDE as you said.

Thanks for the help.

On Tuesday, December 25, 2012 5:14:03 PM UTC, Victor Rocha wrote:
>
> I don't think I can be of more help. Hopefully someone with experience 
> with PyCharm can chime in.
> This is probably not what you want to hear but ditch windows, ditch 
> pycharm use windows and vim or at least gedit.
>
> One last comment, in your manage.py file i can see this 'pkadata.settings'; 
> i didnt see that directory when you showed me your file structure.
>
>
>
> On Tue, Dec 25, 2012 at 12:01 PM, huw_at1  > wrote:
>
>> pkadata.settings
>
>
>

-- 
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/-/xbeOEaE7Ah4J.
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 1.4 manage.py cannot find settings

2012-12-25 Thread Victor Rocha
I don't think I can be of more help. Hopefully someone with experience with
PyCharm can chime in.
This is probably not what you want to hear but ditch windows, ditch pycharm
use windows and vim or at least gedit.

One last comment, in your manage.py file i can see this 'pkadata.settings';
i didnt see that directory when you showed me your file structure.



On Tue, Dec 25, 2012 at 12:01 PM, huw_at1  wrote:

> pkadata.settings

-- 
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: Django 1.4 manage.py cannot find settings

2012-12-25 Thread huw_at1
Hi,

manage.py is show below:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)


I think you may be right...I think I have the project directory set at a 
level too high some how...


On Tuesday, December 25, 2012 1:22:10 PM UTC, huw_at1 wrote:
>
> Hi,
>
> This has probably been asked a million times before so apologies. I'm new 
> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to 
> perform a simple import from within my shell:
>
> from django.contrib.sites.models import Site
>
> However I am constantly getting the problem that my settings are not being 
> found:
>
> raise ImportError("Could not import settings '%s' (Is it on 
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'test.test.settings' (Is it on 
> sys.path?): No module named test.settings
>
> In the past I would have thought that this was an issue as the project and 
> the "app" had the same name although in the case of 1.4 the settings are 
> placed in a directory with the same name as the project. I'm not sure what 
> I should change to get this to work.
>
> Has this been seen before or any ideas?
>
> Many thanks
>

-- 
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/-/EGGUxTvjArEJ.
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 1.4 manage.py cannot find settings

2012-12-25 Thread huw_at1
Hi,

manage.py contents below:

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pkadata.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)


I think you maybe right - I think it may be somewhere the project directory 
is set a level too high...

On Tuesday, December 25, 2012 1:22:10 PM UTC, huw_at1 wrote:
>
> Hi,
>
> This has probably been asked a million times before so apologies. I'm new 
> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to 
> perform a simple import from within my shell:
>
> from django.contrib.sites.models import Site
>
> However I am constantly getting the problem that my settings are not being 
> found:
>
> raise ImportError("Could not import settings '%s' (Is it on 
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'test.test.settings' (Is it on 
> sys.path?): No module named test.settings
>
> In the past I would have thought that this was an issue as the project and 
> the "app" had the same name although in the case of 1.4 the settings are 
> placed in a directory with the same name as the project. I'm not sure what 
> I should change to get this to work.
>
> Has this been seen before or any ideas?
>
> Many thanks
>

-- 
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/-/oGSYDONdBzUJ.
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 1.4 manage.py cannot find settings

2012-12-25 Thread Victor Rocha
I don't have much experience using PyCharm, however from I can understand,
your issues may be alleviated by adding a ___init__.py file at the same
level as your manage.py file. Can you set which dir is the project's root
dir? can you show me the content of your manage.py file?

I am still concern about this 'test.test.settings'  it should only be
'test.settings'

Thank you,
Victor Rocha
RochApps 


On Tue, Dec 25, 2012 at 10:22 AM, huw_at1  wrote:

> Thank you,
> Victor Rocha
> RochApps 
>

-- 
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: Django 1.4 manage.py cannot find settings

2012-12-25 Thread huw_at1
Hi,

This project was created using django 1.4. The structure is as follows:

/home
  |
  --/huw_at1
  |
  ---/TEST
|

-/test-/test-settings.py
 .git   /static 
  urls.py
 /templates
wsgi.py   
 /test_app
 manage.py

So I have a parent container directory called TEST, then the project 
directory within this and then within the project directory django has set 
up the test subdirectory with the settings in. I am using PyCharm to try 
and run the Django console or shell as it is known which appears to run 
from the TEST container directory.

Does this make things clearer? Currently trying to run syncdb has issues 
creating the site because of this issue with not finding the settings as 
well I suspect. Are there any particular environment variables I should be 
setting considering I am running this from Win7?

Many thanks for the response

Huw_at1

On Tuesday, December 25, 2012 2:19:10 PM UTC, Victor Rocha wrote:
>
> Hi,
>
> I would like to ask you to post a snapshot of your dir structure. In the 
> mean time, I am going to give you some pointers that you could consider. Is 
> the an app you converted to django 1.4 or did you created your app from 
> scratch(using 1.4 from the beginning)?
>
> If you converted you app your Error("Could not import settings 
> 'test.test.settings' (Is it on sys.path?): ") indicates that you set your 
> "DJANGO_SETTINGS_MODULE" is set incorrectly. Open your manage.py file and 
> set it the django environmental variable to "test.settings".
>
> If you created your app using django 1.4 from the beginning, I don't see 
> how this error could happen! Django lays out your project for you and sets 
> everything correctly. 
>
> Thank you,
> Victor Rocha
> RochApps <http://www.rochapps.com>
>
>
> On Tuesday, December 25, 2012 8:22:10 AM UTC-5, huw_at1 wrote:
>>
>> Hi,
>>
>> This has probably been asked a million times before so apologies. I'm new 
>> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to 
>> perform a simple import from within my shell:
>>
>> from django.contrib.sites.models import Site
>>
>> However I am constantly getting the problem that my settings are not 
>> being found:
>>
>> raise ImportError("Could not import settings '%s' (Is it on 
>> sys.path?): %s" % (self.SETTINGS_MODULE, e))
>> ImportError: Could not import settings 'test.test.settings' (Is it on 
>> sys.path?): No module named test.settings
>>
>> In the past I would have thought that this was an issue as the project 
>> and the "app" had the same name although in the case of 1.4 the settings 
>> are placed in a directory with the same name as the project. I'm not sure 
>> what I should change to get this to work.
>>
>> Has this been seen before or any ideas?
>>
>> Many thanks
>>
>

-- 
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/-/QfQAXqhRxVoJ.
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 1.4 manage.py cannot find settings

2012-12-25 Thread Victor Rocha
Hi,

I would like to ask you to post a snapshot of your dir structure. In the 
mean time, I am going to give you some pointers that you could consider. Is 
the an app you converted to django 1.4 or did you created your app from 
scratch(using 1.4 from the beginning)?

If you converted you app your Error("Could not import settings 
'test.test.settings' (Is it on sys.path?): ") indicates that you set your 
"DJANGO_SETTINGS_MODULE" is set incorrectly. Open your manage.py file and 
set it the django environmental variable to "test.settings".

If you created your app using django 1.4 from the beginning, I don't see 
how this error could happen! Django lays out your project for you and sets 
everything correctly. 

Thank you,
Victor Rocha
RochApps <http://www.rochapps.com>


On Tuesday, December 25, 2012 8:22:10 AM UTC-5, huw_at1 wrote:
>
> Hi,
>
> This has probably been asked a million times before so apologies. I'm new 
> to 1.4 so the standard project layout is a little unfamiliar. I'm trying to 
> perform a simple import from within my shell:
>
> from django.contrib.sites.models import Site
>
> However I am constantly getting the problem that my settings are not being 
> found:
>
> raise ImportError("Could not import settings '%s' (Is it on 
> sys.path?): %s" % (self.SETTINGS_MODULE, e))
> ImportError: Could not import settings 'test.test.settings' (Is it on 
> sys.path?): No module named test.settings
>
> In the past I would have thought that this was an issue as the project and 
> the "app" had the same name although in the case of 1.4 the settings are 
> placed in a directory with the same name as the project. I'm not sure what 
> I should change to get this to work.
>
> Has this been seen before or any ideas?
>
> Many thanks
>

-- 
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/-/BjA9V-YqpBgJ.
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 1.4 manage.py cannot find settings

2012-12-25 Thread huw_at1
Hi,

This has probably been asked a million times before so apologies. I'm new 
to 1.4 so the standard project layout is a little unfamiliar. I'm trying to 
perform a simple import from within my shell:

from django.contrib.sites.models import Site

However I am constantly getting the problem that my settings are not being 
found:

raise ImportError("Could not import settings '%s' (Is it on sys.path?): 
%s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'test.test.settings' (Is it on 
sys.path?): No module named test.settings

In the past I would have thought that this was an issue as the project and 
the "app" had the same name although in the case of 1.4 the settings are 
placed in a directory with the same name as the project. I'm not sure what 
I should change to get this to work.

Has this been seen before or any ideas?

Many thanks

-- 
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/-/jseW7hnxiUgJ.
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: Installing forum on django 1.4

2012-11-29 Thread Paul Backhouse
On Wed, 2012-11-28 at 03:15 -0800, Yogev Metzuyanim wrote:
> Hi,
> Did someone here managed to install a working forum on django 1.4, I
> tried all these and I got  all kinds of errors:
> PyBB
> django-forum
> django-forumbr
> askbot
> snapboard
> and more...

I suspect your question is too general. You might be better off posting
the errors you get from just one of those apps. You might get even
better results if you posted to a forum that deals specifically with
that particular app. I know askbot uses itself as a support forum.
(http://askbot.org/en/questions/)


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



Installing forum on django 1.4

2012-11-28 Thread Yogev Metzuyanim
Hi,
Did someone here managed to install a working forum on django 1.4, I tried 
all these and I got  all kinds of errors:
PyBB
django-forum
django-forumbr
askbot
snapboard
and more...

Some of them i figured out and then i got another error until I reached a 
dead end in every single one of them.
If anyone had installed one of the above or some other forum on django 1.4 
and it worked, please let me know how you did it.
Thanks.

-- 
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/-/mHwrRL1bsXEJ.
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 1.4: TypeError: get_db_prep_value() got an unexpected keyword argument 'connection'

2012-11-23 Thread Felix Guo
I also have this problem, I don't have any custom field and still see this 
error. 

I have completely remove all previous django, but after I install latest 
django 1.4.2, I can still find your function: get_db_prep_save appeared in  
/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py  
line 872. 

Are you sure your latest installation package completely remove the 
function?

Thank you

Felix Guo

On Sunday, April 8, 2012 1:31:17 PM UTC+10, Russell Keith-Magee wrote:
>
> Hi,
>
> What you've hit here is the end of the deprecation cycle for code that 
> doesn't support multiple databases.
>
> In Django 1.2, we introduced multiple database support; in order to 
> support this, the prototype for get_db_preb_lookup() and 
> get_db_prep_value() was changed.
>
> For backwards compatibility, we added a shim that would transparently 
> 'fix' these methods if they hadn't already been fixed by the developer.
>
> In Django 1.2, the usage of these shims raised a 
> PendingDeprecationWarning. In Django 1.3, they raised a DeprecationWarning.
>
> Under Django 1.4, the shim code was been removed -- so any code that 
> wasn't updated will now raise errors like the one you describe.
>
> All the core Django fields should have been updated to use the new 
> signature, so if you're seeing errors, it's probably because of a custom 
> field that you're using that needs to be updated. As far as I can make out, 
> Django's default ImageField shouldn't have this problem (it doesn't even 
> have db_prep_* methods, because there's nothing database specific about the 
> storage of FileFields).
>
> If you can reproduce this on a project that only uses Django's built-in 
> field types, then this is a bug in Django that needs to be addressed.
>
> Yours
> Russ Magee %-)
>
>
> On Saturday, 7 April 2012 at 12:03 PM, xthepoet wrote:
>
> > This was working fine for my Ubuntu 10.04LTE system with Django
> > 1.3.1. It seems broken now in 1.4.
> > 
> > In Django 1.4, I get this error TypeError: get_db_prep_value() got an
> > unexpected keyword argument 'connection' when saving an image to an
> > ImageField.
> > 
> > System (installed from Ubuntu Lucid repository packages):
> > Django 1.4
> > Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> > 
> > The model field is defined as: origin_image =
> > models.ImageField(upload_to='images/origin')
> > The offending call is: obj.origin_image.save(fbFileName,
> > ContentFile(input_file.getvalue()))
> > 
> > Traceback (most recent call last):
> > File "/home/seeker/src/ceeq/seekerapp/management/commands/
> > addUser.py", line 100, in addPhotos
> > obj.origin_image.save(fbFileName,
> > ContentFile(input_file.getvalue()))
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/fields/files.py", line 95, in save
> > self.instance.save()
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/base.py", line 463, in save
> > self.save_base(using=using, force_insert=force_insert,
> > force_update=force_update)
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/base.py", line 551, in save_base
> > result = manager._insert([self], fields=fields,
> > return_id=update_pk, using=using, raw=raw)
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/manager.py", line 203, in _insert
> > return insert_query(self.model, objs, fields, **kwargs)
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/query.py", line 1576, in insert_query
> > return query.get_compiler(using=using).execute_sql(return_id)
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/sql/compiler.py", line 909, in execute_sql
> > for sql, params in self.as_sql():
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/sql/compiler.py", line 872, in as_sql
> > for obj in self.query.objs
> > File "/usr/local/lib/python2.6/dist-packages/Django-1.4-py2.6.egg/
> > django/db/models/fields/__init__.py", line 292, in get_db_prep_save
> > prepared=False)
> > TypeError: get_db_prep_value() got an unexpected keyword argument
> > 'connection'
> > 
> > This problem was also reported on the django-celery board:
> > https://github.com/ask/celery/issues/624
> > But I've realized that for me, it's not a celery issue.
> > 
> > -- 
> > You received this message becau

Re: MySQL Connector/Python Django 1.4

2012-11-22 Thread Fred Stluka

Dilip,

I'm not using MySQL Connector/Python 
<http://dev.mysql.com/downloads/connector/python/>.


I am using:  http://sourceforge.net/projects/mysql-python/

What's the difference?   Is one better than the other?

What platform?  I've installed it on CentOS Linux and on Mac OS X.
I can give you instructions for those platforms.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.


On 11/22/12 1:11 PM, Dilip M wrote:

Hi,

Have anyone got MySQL Connector/Python 
<http://dev.mysql.com/downloads/connector/python/> (1.0.7) working 
with Django 1.4?


If yes, what the installation procedure and how to get it work?

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



MySQL Connector/Python Django 1.4

2012-11-22 Thread Dilip M
Hi,

Have anyone got MySQL
Connector/Python<http://dev.mysql.com/downloads/connector/python/>
(1.0.7)
working with Django 1.4?

If yes, what the installation procedure and how to get it work?

Thanks..Dilip

-- 
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: Error setting up Django 1.4 on cPanel Server

2012-11-06 Thread Bestrafung
I think I've pretty well ruled out python as the issue. It looks to be in 
the Apache/mod_wsgi setup somewhere. I can start the built-in runserver, 
"python manage.py runserver 0.0.0.0:8000", and work with it but Apache 
refuses to work. I've never worked with mod_wsgi or Django before so I'm 
not sure what's going on yet. For now I'm just using runserver to set 
everything up while working on the bugs.

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



Error setting up Django 1.4 on cPanel Server

2012-11-05 Thread Bestrafung
I am slowly working all of this out and the first 3 or 4 times I tried to 
setup Django on our cPanel server I kept getting the same 403 Forbidden 
error. I scrapped everything and started from scratch as I wanted to use 
Python 2.7 instead of 2.5. Now I am receiving completely different errors 
I've never encountered before. I used the below post on the cpanel forums 
as a guide, making my own changes as necessary, documenting my full 
progress along the way. The new error lists in the browser as a 200 error 
which has me confused as I thought a 200 meant everything was good. I'm 
re-checking everything for a typo but I really have no idea what's causing 
this.

http://forums.cpanel.net/f5/django-python-cpanel-71229-p2.html#post439009

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

// Server Setup \\
\\==//

// download and innstall Python 2.7
// file URL http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xvzf Python-2.7.3.tgz
cd Python-2.7.3
./configure --enable-shared --prefix=/opt/python2.7
make install

// alias python so always opens 2.7
cd /root
echo alias python='/opt/python2.7/bin/python' >> .bash_profile

// fix LD_LIBRARY_PATH
echo /opt/python2.7/lib > /etc/ld.so.conf.d/python2.7.conf
ldconfig

/ install setuptools
// URL http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
/ install MySQLdb for Python
// http://pypi.python.org/pypi/MySQL-python/1.2.3
tar -xvzf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
python setup.py build
python setup.py install

// test import
python
import sqlite3
import MySQLdb
quit()

// install mod_wsgi
// http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz
tar -xvzf mod_wsgi-3.4.tar.gz
cd mod_wsgi-3.4
./configure --with-apxs=/usr/local/apache/bin/apxs 
--with-python=/opt/python2.7/bin/python
make
make install

// In WHM | Apache Setup, in Pre VirtualHost Include, add:
LoadModule wsgi_module /usr/local/apache/modules/mod_wsgi.so
AddHandler wsgi-script .wsgi
WSGISocketPrefix run/wsgi

// create a “run” directory for Apache's .pid files
mkdir -p /usr/local/apache/run
chmod a+w /usr/local/apache/run

===
 Client Setup
===

// Add to user's .bash_profile:
# Use python 2.7
alias python='/opt/python/bin/python'
# Set python path
export PYTHONPATH='$PYTHONPATH:/home/[username]/sites/[domain.com]'

// Prepare the project folder
mkdir -p /home/[user]/sites/[domain]
cd /home/[user]/sites/[domain]
svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
=OR=
svn co http://code.djangoproject.com/svn/django/branches/releases/1.4.X/ django
ln -s django-trunk/django django
mkdir .python-eggs
chmod 777 .python-eggs
/home/[username]/sites/domain.com/django/bin/django-admin.py startproject foobar
cd /home/[username]
chown -R [username]: sites

// test imports as user
python
import MySQLdb
import sqlite3
import django
quit()

// create bootstrap
nano /home/username/public_html/something.wsgi

// contents of bootstrap:
#!/opt/python2.7/bin/python
import os, sys
sys.path.insert(0,'/home/username/sites/domain.com')
os.environ['DJANGO_SETTINGS_MODULE'] = 'foobar.settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/username/sites/domain.com/.python-eggs'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

// setup vhost
mkdir -p /usr/local/apache/conf/userdata/std/2/username/domain.com
nano /usr/local/apache/conf/userdata/std/2/username/domain.com/vhost.conf

// contents of vhost.conf

Alias /robots.txt /home/username/sites/domain.com/foobar/media/robots.txt
Alias /site_media /home/username/sites/domain.com/foobar/media
Alias /admin_media /home/username/sites/domain.com/django/contrib/admin/media



# See the link below for an introduction about this mod_wsgi config.
# 
http://groups.google.com/group/modwsgi/browse_thread/thread/60cb0ec3041ac1bc/2c547b701c4d74aa

WSGIScriptAlias / /home/username/public_html/something.wsgi
WSGIDaemonProcess [username] processes=7 threads=1 display-name=%{GROUP}
WSGIProcessGroup [username]
WSGIApplicationGroup %{GLOBAL} 


# This fixes the broken ErrorDocument directive we inherit that breaks auth
# if we use a WSGI app.
ErrorDocument 401 "Authentication Error"
ErrorDocument 403 "Forbidden"

// include the vhost in apache
/scripts/verify_vhost_includes
/scripts/ensure_vhost_includes --user=username

// restart django just to be sure
touch /home/username/public_html/something.wsgi

Re: Documentation helpers in the admindocs (django 1.4)

2012-10-25 Thread Craig Bateman
I think this is a bug in 1.4 that is probably addressed in the dev version.
The model docstring is not run through the markdown to HTML routine in the
django version I'm using. Was simple enough to patch locally.
On Sep 10, 2012 1:58 PM, "craig"  wrote:

> It could be I'm doing something wrong, but I have the admin documentation
> working, and read about the helpers ( :model:`app.model`, :view:, etc) but
> when I use them the docs render the actual text and not the link:
>
> class Calendar(models.Model):
>> """
>> Contains a collection of :model:`events.Event` objects.
>>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>> """
>
>
> Renders to the admin docs site as
>
> Contains a collection of :model:`events.Event` objects.
>
>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>
>
> I have admin and admindocs apps installed, my tests all pass, so I'm not
> sure whether I'm missing something or not.
>
> --
> 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/-/OUFxqu5lQaoJ.
> 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: Documentation helpers in the admindocs (django 1.4)

2012-10-25 Thread Robert Bergs
This looks like it is a known issue. See ticket 
5405. 


On Monday, 10 September 2012 21:57:49 UTC+1, craig wrote:
>
> It could be I'm doing something wrong, but I have the admin documentation 
> working, and read about the helpers ( :model:`app.model`, :view:, etc) but 
> when I use them the docs render the actual text and not the link:
>
> class Calendar(models.Model):
>> """
>> Contains a collection of :model:`events.Event` objects.
>> 
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>> """
>
>
> Renders to the admin docs site as
>
> Contains a collection of :model:`events.Event` objects. 
>
>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model. 
>
>
> I have admin and admindocs apps installed, my tests all pass, so I'm not 
> sure whether I'm missing something or not.
>

-- 
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/-/tmrFvQVhypwJ.
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 1.4 reusable app template repo

2012-10-11 Thread Dries Desmet
I would appreciate any feedback on my django 1.4 reuasable app template. 
You can find the code here: https://github.com/TrioTorus/django-app-skel

I love the new --template option that comes with django 1.4 now and this is 
my first attempt at a simple skeleton. Would you use such a thing? Are you 
missing something I haven't included? Are the docs clear enough? I'm a bit 
on my island here (django-wise) so any feedback is appreciated.

Regards,

Dries Desmet.

-- 
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/-/vKMVHUJax_gJ.
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: how to layout a "big" project in django 1.4 - best practices ?

2012-09-26 Thread Michel Thadeu Sabchuk

Hi Guys,
 

> And i want ask about settings.py,  if we make the settings become a folder 
> and put dev.py, prod.py,  any step to make manage.py know which one to 
> load. Seems there is no info about it in the blog.
>
I often create a settings module like above:

settings
-->__init__.py
-->base.py
-->custom.py

The __init__ file imports everything from base and custom, custom imports 
everything from base and can replace any base settings. This way I can put 
the __init__ and base files in the repo but keep custom not tracked, since 
it is environment specific.

What are you doing about the project name? I am using the project folder as 
the trunk root, so, doesn't matter what will be his name. The default app 
generally is the project name but we prefer to call it main, so every 
project have the same layout, with the same default app... What do you 
think about it?

Best regards,

Michel Sabchuk

-- 
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/-/mXjdt7lOt4wJ.
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 1.4 and google app engine

2012-09-25 Thread Derek
Then you should not be using GAE.  From 
http://en.wikipedia.org/wiki/Google_App_Engine#Differences_between_SQL_and_GQL

"Unlike a relational database the Datastore API is not relational in the 
SQL sense."

On Saturday, 22 September 2012 23:00:50 UTC+2, neixetis wrote:
>
> Thank you ver much for answer.
> Yes that could be a solution, however I need relational database :/
>
> On Saturday, September 22, 2012 10:32:25 PM UTC+2, Gabriel [SGT] wrote:
>>
>> On Sat, Sep 22, 2012 at 5:16 PM, neixetis <neix...@gmail.com> wrote: 
>> > I am about to deal with the same problem, however I have finished my 
>> > project, now I need to update it asap on GAE, but I just can not as 
>> newest 
>> > version of SDK Django is 1.3, whereas my project is 1.4. Any ideas what 
>> > should I do now? Please help guys:D 
>>
>> You can try the django 1.4 nonrel's version, although is currently in 
>> WIP state, I'm not sure how mature it is 
>> https://github.com/django-nonrel/django-1.4 
>> The nonrel stable (1.3) works pretty well. 
>>
>> -- 
>> Kind Regards 
>>
>

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



Setting up Django 1.4 for a production environment

2012-09-23 Thread Zach
I am new to django and I am having trouble following the instructions on 
setting up django with apache and mod_wsgi. Apache 2.2.22, Python 2.7.2 and 
mod_wsgi are all install on my machine running Mac os X 10.8.2 (mountain 
lion). I have imported a conf file to my httpd file with the following

WSGIScriptAlias / /Users/Zachary/Sites/django/project/project/wsgi.py
 


Order deny,allow
Allow from all



I just want to get the initial django project setup so it goes to the "it 
works" page. My wsgi.py is the default file with the following

import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

I am sure I am missing a lot, so if anyone can just point me in the right 
direction that would be awesome! I do know mod_wsgi is installed and 
running because I was able to get the hello world file from their 
configuration tutorial to work

-- 
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/-/foi5DE1zsWYJ.
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 1.4 and google app engine

2012-09-22 Thread neixetis
Thank you ver much for answer.
Yes that could be a solution, however I need relational database :/

On Saturday, September 22, 2012 10:32:25 PM UTC+2, Gabriel [SGT] wrote:
>
> On Sat, Sep 22, 2012 at 5:16 PM, neixetis <neix...@gmail.com > 
> wrote: 
> > I am about to deal with the same problem, however I have finished my 
> > project, now I need to update it asap on GAE, but I just can not as 
> newest 
> > version of SDK Django is 1.3, whereas my project is 1.4. Any ideas what 
> > should I do now? Please help guys:D 
>
> You can try the django 1.4 nonrel's version, although is currently in 
> WIP state, I'm not sure how mature it is 
> https://github.com/django-nonrel/django-1.4 
> The nonrel stable (1.3) works pretty well. 
>
> -- 
> Kind Regards 
>

-- 
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/-/99OD-XWK3lkJ.
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 1.4 and google app engine

2012-09-22 Thread Gabriel [SGT]
On Sat, Sep 22, 2012 at 5:16 PM, neixetis <neixe...@gmail.com> wrote:
> I am about to deal with the same problem, however I have finished my
> project, now I need to update it asap on GAE, but I just can not as newest
> version of SDK Django is 1.3, whereas my project is 1.4. Any ideas what
> should I do now? Please help guys:D

You can try the django 1.4 nonrel's version, although is currently in
WIP state, I'm not sure how mature it is
https://github.com/django-nonrel/django-1.4
The nonrel stable (1.3) works pretty well.

-- 
Kind 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: Django 1.4 and google app engine

2012-09-22 Thread neixetis
Does it mean that few months ago newest django version for Google Cloud SQL 
was 1.4, and now they downgraded to 1.3? Or that was just a mistake?

I am about to deal with the same problem, however I have finished my 
project, now I need to update it asap on GAE, but I just can not as newest 
version of SDK Django is 1.3, whereas my project is 1.4. Any ideas what 
should I do now? Please help guys:D

On Sunday, June 17, 2012 5:49:15 PM UTC+2, Guevara wrote:
>
> In GAE only using django-norel, a fork of django with no join's queryset.
>
> https://developers.google.com/appengine/articles/django-nonrel
>
> Or using in Google Cloud SQL:
>
> https://developers.google.com/appengine/docs/python/cloud-sql/django
>
> But is a paying service.
>
>
> 2012/6/17 Gebriel Abebe 
>
>> Please I want to know the same thing?
>>
>>  -- 
>> 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/-/bU3CTr2hjmQJ.
>>
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/zewtROlBqb8J.
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: Hung apache threads after upgrading to django 1.4

2012-09-13 Thread Dane
We have extended status on.  Here is a link to our full status output. 
 This does not occur consistently, but under high traffic we see an 
increasing amount of occurrences.

I appreciate the help.

http://pastebin.com/wP8Xfrwf

On Wednesday, September 12, 2012 9:20:10 AM UTC-5, Tom Evans wrote:
>
> On Wed, Sep 12, 2012 at 2:49 PM, Dane <daneg...@gmail.com > 
> wrote: 
> > After using django 1.3 for a while I upgraded to django 1.4 and started 
> > noticing apache threads hanging indefinitely.  I set a timeout to avoid 
> > running out of threads, but it would be nice to know what is causing the 
> > issue in the first place. 
> > 
> > Using an strace, I found that the threads are attempting to read from a 
> > socket and are not doing anything after that. 
> > 
> > The apache logs were not helpful, but we did find the following 
> stacktrace 
> > in our mod_wsgi process: 
>
> The stacktrace doesn't look relevant tbh. 
>
> How are you determining that you have hanging threads? Eg, is the 
> scoreboard completely full? 
>
> It would be easier to debug if you could capture a snapshot of the 
> scoreboard whilst you think you are being affected. mod_status is your 
> friend, turn "ExtendedStatus on". 
>
> Cheers 
>
> Tom 
>

-- 
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/-/SHH0MsPA8tQJ.
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: Hung apache threads after upgrading to django 1.4

2012-09-12 Thread Tom Evans
On Wed, Sep 12, 2012 at 2:49 PM, Dane <daneguem...@gmail.com> wrote:
> After using django 1.3 for a while I upgraded to django 1.4 and started
> noticing apache threads hanging indefinitely.  I set a timeout to avoid
> running out of threads, but it would be nice to know what is causing the
> issue in the first place.
>
> Using an strace, I found that the threads are attempting to read from a
> socket and are not doing anything after that.
>
> The apache logs were not helpful, but we did find the following stacktrace
> in our mod_wsgi process:

The stacktrace doesn't look relevant tbh.

How are you determining that you have hanging threads? Eg, is the
scoreboard completely full?

It would be easier to debug if you could capture a snapshot of the
scoreboard whilst you think you are being affected. mod_status is your
friend, turn "ExtendedStatus on".

Cheers

Tom

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



Hung apache threads after upgrading to django 1.4

2012-09-12 Thread Dane
After using django 1.3 for a while I upgraded to django 1.4 and started 
noticing apache threads hanging indefinitely.  I set a timeout to avoid 
running out of threads, but it would be nice to know what is causing the 
issue in the first place.

Using an strace, I found that the threads are attempting to read from a 
socket and are not doing anything after that.

The apache logs were not helpful, but we did find the following stacktrace 
in our mod_wsgi process:

[Wed Aug 22 15:20:49 2012] [error] # ProcessId: 17018

[Wed Aug 22 15:20:49 2012] [error] # ThreadID: 1135962432

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 
241, in __call__

[Wed Aug 22 15:20:49 2012] [error]   response = self.get_response(request)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/core/handlers/base.py", line 
111, in get_response

[Wed Aug 22 15:20:49 2012] [error]   response = callback(request, 
*callback_args, **callback_kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/contrib/auth/decorators.py", 
line 20, in _wrapped_view

[Wed Aug 22 15:20:49 2012] [error]   return view_func(request, *args, 
**kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_openid_auth/user_whitelist/decorators.py",
 
line 25, in decorated

[Wed Aug 22 15:20:49 2012] [error]   return func(request, *args, **kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_django/dispatcher.py", line 
91, in __call__

[Wed Aug 22 15:20:49 2012] [error]   return (handler(request, *args, 
**kwargs) if handler else

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/contrib/auth/decorators.py", 
line 20, in _wrapped_view

[Wed Aug 22 15:20:49 2012] [error]   return view_func(request, *args, 
**kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_openid_auth/user_whitelist/decorators.py",
 
line 25, in decorated

[Wed Aug 22 15:20:49 2012] [error]   return func(request, *args, **kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_user_authorization/decorators.py", 
line 34, in decorated

[Wed Aug 22 15:20:49 2012] [error]   return func(request, *args, **kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_django/templates_decorators.py", 
line 61, in wrapped

[Wed Aug 22 15:20:49 2012] [error]   return func(request, *args, **kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_django/multiresponse.py", line 
83, in wrapper

[Wed Aug 22 15:20:49 2012] [error]   context_instance, headers)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/axiom_django/multiresponse.py", line 
112, in __get_response

[Wed Aug 22 15:20:49 2012] [error]   context_instance = context_instance)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/shortcuts/__init__.py", line 
20, in render_to_response

[Wed Aug 22 15:20:49 2012] [error]   return 
HttpResponse(loader.render_to_string(*args, **kwargs), 
**httpresponse_kwargs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/template/loader.py", line 
169, in render_to_string

[Wed Aug 22 15:20:49 2012] [error]   t = get_template(template_name)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/template/loader.py", line 
145, in get_template

[Wed Aug 22 15:20:49 2012] [error]   template, origin = 
find_template(template_name)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/template/loader.py", line 
134, in find_template

[Wed Aug 22 15:20:49 2012] [error]   source, display_name = loader(name, 
dirs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/template/loader.py", line 42, 
in __call__

[Wed Aug 22 15:20:49 2012] [error]   return 
self.load_template(template_name, template_dirs)

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/dispatch/saferef.py", line 
121, in remove

[Wed Aug 22 15:20:49 2012] [error]   function( self )

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 
250, in _remove_receiver

[Wed Aug 22 15:20:49 2012] [error]   for idx, (r_key, _) in 
enumerate(reversed(self.receivers)):

[Wed Aug 22 15:20:49 2012] [error] File: 
"/opt/py26/lib/python2.6/site-packages/django/dispatch/saferef.py", line 
121, in remove

[Wed Aug 22 15:20:49 2012] [error]   functi

Re: Documentation helpers in the admindocs (django 1.4)

2012-09-10 Thread craig
Just in case it pop's on anyone's radar, the :model:`ScheduledEvent` was 
just an attempt at doing it differently since ScheduledEvent is in the same 
app as the Calendar class.  So it's failing whether I provide the app name 
all the time or not.

On Monday, September 10, 2012 1:57:49 PM UTC-7, craig wrote:
>
> It could be I'm doing something wrong, but I have the admin documentation 
> working, and read about the helpers ( :model:`app.model`, :view:, etc) but 
> when I use them the docs render the actual text and not the link:
>
> class Calendar(models.Model):
>> """
>> Contains a collection of :model:`events.Event` objects.
>> 
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>> """
>
>
> Renders to the admin docs site as
>
> Contains a collection of :model:`events.Event` objects. 
>
>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model. 
>
>
> I have admin and admindocs apps installed, my tests all pass, so I'm not 
> sure whether I'm missing something or not.
>

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



Documentation helpers in the admindocs (django 1.4)

2012-09-10 Thread craig
It could be I'm doing something wrong, but I have the admin documentation 
working, and read about the helpers ( :model:`app.model`, :view:, etc) but 
when I use them the docs render the actual text and not the link:

class Calendar(models.Model):
> """
> Contains a collection of :model:`events.Event` objects.
> 
> Events are mapped to calendars through the :model:`ScheduledEvent`
> model.
> """


Renders to the admin docs site as

Contains a collection of :model:`events.Event` objects. 


> Events are mapped to calendars through the :model:`ScheduledEvent`
> model. 


I have admin and admindocs apps installed, my tests all pass, so I'm not 
sure whether I'm missing something or not.

-- 
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/-/OUFxqu5lQaoJ.
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 1.4 using locale urls

2012-09-02 Thread Mo Mughrabi
Hi, am stuck with trying to use locale urls and applying language prefix. I
tried to follow the manual but i guess i might have missed something, i
also tried posting a question on stackoverflow but no signs yet. Any one
can guide me, I would appreciate it.

http://stackoverflow.com/questions/12227271/url-locale-using-django-1-4

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: django 1.4: Error importing email backend module django.core.mail.backends.smtp: "cannot import name sanitize_address"

2012-08-17 Thread Jan Vilhuber
Please ignore this message. Seems to be a local issue with my instlal 
somehow.
jan


On Friday, August 17, 2012 2:41:49 PM UTC-6, Jan Vilhuber wrote:
>
> I see the import in core.mail.backends.smtp, but I don't see 
> sanity_address in core.mail.message, which is where it's trying to import 
> from:
>
> from django.core.mail.message import sanitize_address
>
> Please advise.
> jan
>
>

-- 
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/-/LxRNCTQFwSUJ.
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 1.4: Error importing email backend module django.core.mail.backends.smtp: "cannot import name sanitize_address"

2012-08-17 Thread Jan Vilhuber
I see the import in core.mail.backends.smtp, but I don't see sanity_address in 
core.mail.message, which is where it's trying to import from:

from django.core.mail.message import sanitize_address

Please advise.
jan

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



  1   2   3   >