Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread termopro
You don't need Django for that.
The idea behind responsive images is that you can scale them and adapt to 
users screen using css. 

On Thursday, November 20, 2014 8:05:45 AM UTC+2, ThomasTheDjangoFan wrote:
>
> Hi guys,
>
> do you have a tip for implementing adaptive (responsive) images in django?
>
> Basically I want to server smaller images to mobile-users and bigger 
> images to desktop users.
> I don't really now about best practices for SEO and Siteload-Performance.
>
> Are there any apps that you can recon for this?
>
> Thanks a lot for your tips!
>
> Kind regards
> Thomas
>

-- 
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/247957e4-21d9-465a-b72b-d1c5f881ec09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Alex Strickland

On 2014-11-20 08:05 AM, ThomasTheDjangoFan wrote:


do you have a tip for implementing adaptive (responsive) images in django?

Basically I want to server smaller images to mobile-users and bigger
images to desktop users.
I don't really now about best practices for SEO and Siteload-Performance.

Are there any apps that you can recon for this?

Thanks a lot for your tips!


Have a look at Bootstrap 3, lot's of adaptive stuff (client side though, 
so no real effect on Django).


--
Regards
Alex

--
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/546DAA08.8070505%40mweb.co.za.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Andreas Kuhne
2014-11-20 9:44 GMT+01:00 Alex Strickland :

> On 2014-11-20 08:05 AM, ThomasTheDjangoFan wrote:
>
>  do you have a tip for implementing adaptive (responsive) images in django?
>>
>> Basically I want to server smaller images to mobile-users and bigger
>> images to desktop users.
>> I don't really now about best practices for SEO and Siteload-Performance.
>>
>> Are there any apps that you can recon for this?
>>
>> Thanks a lot for your tips!
>>
>
> Have a look at Bootstrap 3, lot's of adaptive stuff (client side though,
> so no real effect on Django).
>
> --
> Regards
> Alex
>
> --
> 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/546DAA08.8070505%40mweb.co.za.
> For more options, visit https://groups.google.com/d/optout.
>

Bootstrap only scales the images on other devices, you are still serving
the same size of images to the user (the download size will still be the
same).

I really don't know anything that will do what you want (you would have to
look at the user agent and serve different images depending on agent). I
think you should be able to use something like the "easy thumbnail" plugin
for creating different sized images for different devices. Don't know about
serving different images depending on device though.

Regards,

Andréas

-- 
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/CALXYUbn_GZ%2B1%2BFQ%2BDzKgDq_DP0XidoxGuOQpFF71YH6Tpf7mDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


default login template not found (registration/login.html)

2014-11-20 Thread 顏大剛
Hi,

I follow the doc to test the login system. I set a view function with
@login_required to show successful login message.

In the html, a link like:
Login

The URLconf under 'account' namespace contains one url:
url(r'^login/$', 'django.contrib.auth.views.login', name='login',)


It shows the exceptions, and I show the traceback here:







*Template Loader Error:Django tried loading these templates, in this
order:Using loader django.template.loaders.filesystem.Loader:/templates/registration/login.html (File does not exist)Using
loader
django.template.loaders.app_directories.Loader:/usr/local/lib/python3.2/dist-packages/django/contrib/admin/templates/registration/login.html
(File does not
exist)/usr/local/lib/python3.2/dist-packages/django/contrib/auth/templates/registration/login.html
(File does not exist)*
I found one login.html in 'django/contrib/admin/templates/admin/login.html'.
Is it a bug or I miss something?

Yen

-- 
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/CAFnq%3D1iCtD9KYK52VdOnrUtqEoyCP5b8jNiwYspc2M73X7bJ0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: default login template not found (registration/login.html)

2014-11-20 Thread Sergiy Khohlov
Check  your settings.py for TEMPLATE_DIRS

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Thu, Nov 20, 2014 at 7:48 AM, 顏大剛  wrote:

> Hi,
>
> I follow the doc to test the login system. I set a view function with
> @login_required to show successful login message.
>
> In the html, a link like:
> Login
>
> The URLconf under 'account' namespace contains one url:
> url(r'^login/$', 'django.contrib.auth.views.login', name='login',)
>
>
> It shows the exceptions, and I show the traceback here:
>
>
>
>
>
>
>
> *Template Loader Error:Django tried loading these templates, in this
> order:Using loader django.template.loaders.filesystem.Loader: project>/templates/registration/login.html (File does not exist)Using
> loader
> django.template.loaders.app_directories.Loader:/usr/local/lib/python3.2/dist-packages/django/contrib/admin/templates/registration/login.html
> (File does not
> exist)/usr/local/lib/python3.2/dist-packages/django/contrib/auth/templates/registration/login.html
> (File does not exist)*
> I found one login.html in
> 'django/contrib/admin/templates/admin/login.html'.
> Is it a bug or I miss something?
>
> Yen
>
> --
> 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/CAFnq%3D1iCtD9KYK52VdOnrUtqEoyCP5b8jNiwYspc2M73X7bJ0Q%40mail.gmail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJPmZWKNd1CE%2BYrtgSwAmD24zwxGoWM%3DaXrO-zaZnOBs0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: default login template not found (registration/login.html)

2014-11-20 Thread Daniel Roseman
On Thursday, 20 November 2014 11:39:09 UTC, Yen wrote:
>
> Hi, 
>
> I follow the doc to test the login system. I set a view function with 
> @login_required to show successful login message. 
>
> In the html, a link like:
> Login
>
> The URLconf under 'account' namespace contains one url:
> url(r'^login/$', 'django.contrib.auth.views.login', name='login',)
>
>
> It shows the exceptions, and I show the traceback here:
>
>
>
>
>
>
>
> *Template Loader Error:Django tried loading these templates, in this 
> order:Using loader django.template.loaders.filesystem.Loader: project>/templates/registration/login.html (File does not exist)Using 
> loader 
> django.template.loaders.app_directories.Loader:/usr/local/lib/python3.2/dist-packages/django/contrib/admin/templates/registration/login.html
>  
> (File does not 
> exist)/usr/local/lib/python3.2/dist-packages/django/contrib/auth/templates/registration/login.html
>  
> (File does not exist)*
> I found one login.html in 
> 'django/contrib/admin/templates/admin/login.html'.
> Is it a bug or I miss something?
>
> Yen
>

There is no default login template. If you want a login form, you need to 
provide a template. See the docs 
at 
https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.views.login:
"It’s your responsibility to provide the html for the login template , 
called registration/login.html by default."
--
DR. 

-- 
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/94f9570d-e9dc-48da-8571-85a2eb3dc984%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Jorge Andrés Vergara Ebratt
Actually yo could do it with CSS alone...

You can have the 2 images on the server and add both in the html




And having the CSS like:

On Thu, Nov 20, 2014, 3:59 AM Andreas Kuhne 
wrote:

> 2014-11-20 9:44 GMT+01:00 Alex Strickland :
>
>> On 2014-11-20 08:05 AM, ThomasTheDjangoFan wrote:
>>
>>  do you have a tip for implementing adaptive (responsive) images in
>>> django?
>>>
>>> Basically I want to server smaller images to mobile-users and bigger
>>> images to desktop users.
>>> I don't really now about best practices for SEO and Siteload-Performance.
>>>
>>> Are there any apps that you can recon for this?
>>>
>>> Thanks a lot for your tips!
>>>
>>
>> Have a look at Bootstrap 3, lot's of adaptive stuff (client side though,
>> so no real effect on Django).
>>
>> --
>> Regards
>> Alex
>>
>> --
>> 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/546DAA08.8070505%40mweb.co.za.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Bootstrap only scales the images on other devices, you are still serving
> the same size of images to the user (the download size will still be the
> same).
>
> I really don't know anything that will do what you want (you would have to
> look at the user agent and serve different images depending on agent). I
> think you should be able to use something like the "easy thumbnail" plugin
> for creating different sized images for different devices. Don't know about
> serving different images depending on device though.
>
> Regards,
>
> Andréas
>
> --
> 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/CALXYUbn_GZ%2B1%2BFQ%2BDzKgDq_DP0XidoxGuOQpFF71YH6Tpf7mDw%40mail.gmail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAeX05GYWW29ihbGaWkCAn74OyU4fnD8TaEmupNSjSxZbv_3ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Jorge Andrés Vergara Ebratt
Sorry, I hitted send instead of enter...

As I was saying, you can have both images in the server, and have them both
in the HTML
1. img class="big" src="path/to/big
2. img class="small" src="path to small"

Then in the CSS you add
.small {display: none;}

and a media query for small screens
You can set the media query for the screen size you are going to make the
change and just swap display none to the big one



On Thu Nov 20 2014 at 7:26:27 AM Jorge Andrés Vergara Ebratt <
javebr...@gmail.com> wrote:

> Actually yo could do it with CSS alone...
>
> You can have the 2 images on the server and add both in the html
>
>
>
>
> And having the CSS like:
>
> On Thu, Nov 20, 2014, 3:59 AM Andreas Kuhne 
> wrote:
>
>> 2014-11-20 9:44 GMT+01:00 Alex Strickland :
>>
>>> On 2014-11-20 08:05 AM, ThomasTheDjangoFan wrote:
>>>
>>>  do you have a tip for implementing adaptive (responsive) images in
 django?

 Basically I want to server smaller images to mobile-users and bigger
 images to desktop users.
 I don't really now about best practices for SEO and
 Siteload-Performance.

 Are there any apps that you can recon for this?

 Thanks a lot for your tips!

>>>
>>> Have a look at Bootstrap 3, lot's of adaptive stuff (client side though,
>>> so no real effect on Django).
>>>
>>> --
>>> Regards
>>> Alex
>>>
>>> --
>>> 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/ms
>>> gid/django-users/546DAA08.8070505%40mweb.co.za.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> Bootstrap only scales the images on other devices, you are still serving
>> the same size of images to the user (the download size will still be the
>> same).
>>
>> I really don't know anything that will do what you want (you would have
>> to look at the user agent and serve different images depending on agent). I
>> think you should be able to use something like the "easy thumbnail" plugin
>> for creating different sized images for different devices. Don't know about
>> serving different images depending on device though.
>>
>> Regards,
>>
>> Andréas
>>
>> --
>> 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/CALXYUbn_GZ%2B1%2BFQ%2BDzKgDq_
>> DP0XidoxGuOQpFF71YH6Tpf7mDw%40mail.gmail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAeX05F40WniWKStonxHO_Tysy0HA4wbmfeqEvjV86o6oqnFmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-20 Thread ajohnston
I would recommend that you read the book "Two Scoops of Django" which 
covers many (all?) of the issues involved with maintaining 
dev/staging/production environments, including the kinds of deployment 
questions you're asking. I think it will answer a lot of your questions, 
then maybe you could ask here about more specific issues you still have.

-- 
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/78b7b8df-cf7e-400b-834e-f8da78165848%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Andreas Kuhne
2014-11-20 13:32 GMT+01:00 Jorge Andrés Vergara Ebratt 
:

> Sorry, I hitted send instead of enter...
>
> As I was saying, you can have both images in the server, and have them
> both in the HTML
> 1. img class="big" src="path/to/big
> 2. img class="small" src="path to small"
>
> Then in the CSS you add
> .small {display: none;}
>
> and a media query for small screens
> You can set the media query for the screen size you are going to make the
> change and just swap display none to the big one
>
>
>
> On Thu Nov 20 2014 at 7:26:27 AM Jorge Andrés Vergara Ebratt <
> javebr...@gmail.com> wrote:
>
>> Actually yo could do it with CSS alone...
>>
>> You can have the 2 images on the server and add both in the html
>>
>>
>>
>>
>> And having the CSS like:
>>
>> On Thu, Nov 20, 2014, 3:59 AM Andreas Kuhne 
>> wrote:
>>
>>> 2014-11-20 9:44 GMT+01:00 Alex Strickland :
>>>
 On 2014-11-20 08:05 AM, ThomasTheDjangoFan wrote:

  do you have a tip for implementing adaptive (responsive) images in
> django?
>
> Basically I want to server smaller images to mobile-users and bigger
> images to desktop users.
> I don't really now about best practices for SEO and
> Siteload-Performance.
>
> Are there any apps that you can recon for this?
>
> Thanks a lot for your tips!
>

 Have a look at Bootstrap 3, lot's of adaptive stuff (client side
 though, so no real effect on Django).

 --
 Regards
 Alex

 --
 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/ms
 gid/django-users/546DAA08.8070505%40mweb.co.za.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> Bootstrap only scales the images on other devices, you are still serving
>>> the same size of images to the user (the download size will still be the
>>> same).
>>>
>>> I really don't know anything that will do what you want (you would have
>>> to look at the user agent and serve different images depending on agent). I
>>> think you should be able to use something like the "easy thumbnail" plugin
>>> for creating different sized images for different devices. Don't know about
>>> serving different images depending on device though.
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>> --
>>> 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/CALXYUbn_GZ%2B1%2BFQ%2BDzKgDq_
>>> DP0XidoxGuOQpFF71YH6Tpf7mDw%40mail.gmail.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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAeX05F40WniWKStonxHO_Tysy0HA4wbmfeqEvjV86o6oqnFmQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

That's just the same solution as Bootstrap really.

// Andréas

-- 
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/CALXYUbkWtBiaoqc1wrmGJ%2Bbz3jEoN46q_wZQaFC-2q31-AZ3wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Cal Leeming [iops.io]
It really depends on what your end goal is.

tl;dr - the fastest fix for you will probably be to use CloudFlare polish
[1]

Long answer:

Responsive images are fine, but useless on mobile devices if your original
image is not mobile optimized (due to bandwidth/speed limitations on most
networks, if not all networks), but you also don't want to be serving a
mobile optimized image to desktop users or those with more bandwidth. Some
networks will optimize automatically, but this is still hit and mess.

There's a couple of options..

* CloudFlare has some image optimisation as part of their free CDN offering
[1]
* Compiling your UI elements/artwork into sprite sheets reduce the number
of requests, which can give a dramatic speed increase [2]
* Knowing when to use JPGs vs PNGs (e.g. PNGs for UI elements, JPGs for
heavy detail such as photos)
* Splitting your CDN requests over 4 different host names can speed things,
due to the way most browsers handle concurrency (cdn1.images.example.com,
cdn2.images.example.com etc)

Some things to note;

* In regards to SEO, sprite sheets shouldn't be used for content specific
assets, e.g. if you have a page about bridges, and you have 4 images of
bridges with filenames which relate to bridges, then you will get a bit
higher score. But if you sprite those images, you won't reap the SEO
benefits. Hence only use sprite sheets for UI and non content specific
artwork.

* Lazy loading high quality images is another approach, e.g. you set the
src/background-image to the super low quality version, then lazy load a
higher quality one. This approach is questionable, and depends on whether
your UI *really* needs artwork immediately in order to function.. and
whether it will suffice using a few seconds of lower quality, waiting for
the higher quality ones to load. Use with caution, this can get pretty
hacky.

* If using responsive design rather than adaptive (there is a difference)
[3] [4], then you need to carefully crop your master image to have a "safe
zone" which scales accordingly with the layout. The safe zone is the area
of the image that you always want to be displayed, everything outside of it
being optional context if space permits. If using adaptive, you can crop
your images to the specific dimensions required rather than rely on
background-position/overflow/background-size trickery, but this is more
work. There are also tools which will crop your image on demand [5] [6] but
these do not work well with high performance sites and, in my personal
opinion, are completely the wrong way to approach asset pipelining.

Gotta cut this post short as I need to run, but hope this helps.

Cal

[1]
http://blog.cloudflare.com/introducing-polish-automatic-image-optimizati/
[2] https://github.com/Ensighten/spritesmith
[3]
http://www.techrepublic.com/blog/web-designer/what-is-the-difference-between-responsive-vs-adaptive-web-design/
[4]
http://teamtreehouse.com/library/build-a-responsive-website/introduction-to-responsive-web-design/fixed-fluid-adaptive-and-responsive-2
[5] https://github.com/jonasundderwolf/django-image-cropping
[6] https://github.com/littleweaver/django-daguerre

On Thu, Nov 20, 2014 at 6:05 AM, ThomasTheDjangoFan <
stefan.eichholz.ber...@googlemail.com> wrote:

> Hi guys,
>
> do you have a tip for implementing adaptive (responsive) images in django?
>
> Basically I want to server smaller images to mobile-users and bigger
> images to desktop users.
> I don't really now about best practices for SEO and Siteload-Performance.
>
> Are there any apps that you can recon for this?
>
> Thanks a lot for your tips!
>
> Kind regards
> Thomas
>
> --
> 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/71b23537-2264-4f44-9d67-841c6276f10b%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagFo5CoiAzD9GU-UQMhkPqkfPu0_DEdw_ppuGObCa9ZkqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Patrick Beeson
AListApart recently published a great article on responsive 
images: http://alistapart.com/article/responsive-images-in-practice

On Thursday, November 20, 2014 1:05:45 AM UTC-5, ThomasTheDjangoFan wrote:
>
> Hi guys,
>
> do you have a tip for implementing adaptive (responsive) images in django?
>
> Basically I want to server smaller images to mobile-users and bigger 
> images to desktop users.
> I don't really now about best practices for SEO and Siteload-Performance.
>
> Are there any apps that you can recon for this?
>
> Thanks a lot for your tips!
>
> Kind regards
> Thomas
>

-- 
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/0ea0a557-8043-4bfa-bc2f-23c2561e2245%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError: cannot import name 'GEOSException'

2014-11-20 Thread Tom Lockhart

On Nov 19, 2014, at 2:24 PM, jogaserbia  wrote:

> Thanks for the help Carl.  Also, thanks for filing the ticket. 
> 
> Every bit of info helps.  I really do like Python and Django so far.  
> 
> I am just wondering whether I should just quit trying to make GeoDjango work 
> on my windows machine (at work).  I will be setting up a linux machine at 
> home in the next couple of months, and can try it out again.  

Windows boxes can be cranky and annoying, but I’d stick with it and just Make 
It Work. Once you have a complete installation (and document how you got 
there!) you won’t have to think hard about it again. Or use virtualbox (and 
Docker on top of it) to get started with your Linux installation now.

You *are* using virtualenv, right? That is very high on my list of things that 
make my life easier for setting up development systems and deploying to 
production. You may find that it helps with some of the issues you are seeing 
on your system.

> As a workaround, what I could probably do (if I can figure it out) is call 
> the postgres fuctions for distance between Lon Lat points that will serve as 
> the basis for the application that I am building.  

Yeah, I wrote that code back in the day and I would use GeoDjango. Not that it 
doesn’t do what it says it does, but GeoDjango gives you everything you will 
need all at once.

hth

- 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/39DE9C97-10DD-4C0A-85B2-3B8EAE12B093%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError: cannot import name 'GEOSException'

2014-11-20 Thread jogaserbia
Hi Thomas,

Thanks for the reply.  Yes, I am using a virtualenv for this project.  I'll 
try to stick it out with GeoDjango, but I really do not know what to do now 
to try to continue on with the install.  

At this point in my Django career, I am pretty much a monkey banking on a 
keyboard when troubleshooting this type of issue.   On that note, can you 
possible refer me to any program/documentation on how I would troubleshoot 
such an issue (stepping through code, checking variable values, etc).

If and when I get this up and running, I'll have to put all of the info 
somewhere, for other peoples' reference.  

Ivan  

On Thursday, November 20, 2014 9:38:09 AM UTC-5, Thomas wrote:
>
>
> On Nov 19, 2014, at 2:24 PM, jogaserbia > 
> wrote: 
>
> > Thanks for the help Carl.  Also, thanks for filing the ticket. 
> > 
> > Every bit of info helps.  I really do like Python and Django so far.   
> > 
> > I am just wondering whether I should just quit trying to make GeoDjango 
> work on my windows machine (at work).  I will be setting up a linux machine 
> at home in the next couple of months, and can try it out again.   
>
> Windows boxes can be cranky and annoying, but I’d stick with it and just 
> Make It Work. Once you have a complete installation (and document how you 
> got there!) you won’t have to think hard about it again. Or use virtualbox 
> (and Docker on top of it) to get started with your Linux installation now. 
>
> You *are* using virtualenv, right? That is very high on my list of things 
> that make my life easier for setting up development systems and deploying 
> to production. You may find that it helps with some of the issues you are 
> seeing on your system. 
>
> > As a workaround, what I could probably do (if I can figure it out) is 
> call the postgres fuctions for distance between Lon Lat points that will 
> serve as the basis for the application that I am building.   
>
> Yeah, I wrote that code back in the day and I would use GeoDjango. Not 
> that it doesn’t do what it says it does, but GeoDjango gives you everything 
> you will need all at once. 
>
> hth 
>
> - 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/fa610d6b-352e-411b-b831-1540b2c67724%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DecimalField returns 'This value must be a decimal number' when blank

2014-11-20 Thread elcaiaimar
I' ve seen that south is for older django versions than 1.7, I continue 
having the same problem, I wonder if the issue will be in my views, when I 
save all the information, please, have a look to my code:

if 'formulariopozo' in request.POST:
formulario = PozosForm(request.POST)
if formulario.is_valid():
titulo = 'Formulario de pozos'

codpozo=request.POST['codpozo']
x=request.POST['coorx']
y=request.POST['coory']
tipo=request.POST['tipo']
cotatrapa=request.POST['cotatrapa']
profundidad=request.POST['profundidad']
cotafondo=request.POST['cotafondo']
material=request.POST['material']
materialpates=request.POST['materialpates']
diametro=request.POST['diametro']
largotrapa=request.POST['largotrapa']
seccionmayor=request.POST['seccionmayor']
seccionmenor=request.POST['seccionmenor']
numacometidas=request.POST['numacometidas']
origen=request.POST['origen']
observaciones=request.POST['observaciones']

pnt=Point(float(x),float(y))
xy=Pozo(codpozo=codpozo, coorx=x, coory=y, tipo=tipo, 
cotatrapa=cotatrapa,
profundidad=profundidad, cotafondo=cotafondo, material=material,
materialpates=materialpates, diametro=diametro, 
largotrapa=largotrapa,
seccionmayor=seccionmayor, seccionmenor=seccionmenor, 
numacometidas=numacometidas,
origen=origen, observaciones=observaciones, geom=pnt)

xy.save()

I've tried to put default=None or default=Decimal('0.00') in my models.py 
but it continues without working. I don't know what can I do

Thank you very much

El domingo, 16 de noviembre de 2014 18:51:43 UTC+1, elcaiaimar escribió:
>
> Hello everybody, I've a problem with DecimalField at Forms. I've a long 
> form in my template and I want to left some fields in blank. I've declared 
> these fields with 
> *required=False*, but when I submit the form I receive this error: '*This 
> value must be a decimal number*'.
>
> I've tried to declare *blank=True, null=True* in respective fields in 
> models.py and make a syncdb but it continues without works
>
> Does somebody know how could I solve this problem?
>
> Thank you very much!
>

-- 
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/41cbd070-ad71-4eea-a7d4-23fbd21190c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError: cannot import name 'GEOSException'

2014-11-20 Thread Tom Lockhart
> Thanks for the reply.  Yes, I am using a virtualenv for this project.  I’ll 
> try to stick it out with GeoDjango, but I really do not know what to do now 
> to try to continue on with the install.  

I would probably stop “continuing”, and go back to the start. afaict the 
installation instructions for Windows in the Django docs (mentioned by Carl) 
should address the path issues you are seeing. In particular, the lines 
including “set PATH=%PATH%;…” and the registry updates in the “Modify Windows 
environment” section of the GeoDjango installation instructions would seem to 
cover it.

If after starting over and slavishly following the instructions you still see 
the path issues, post the values of the variables from the installation 
instructions which are actually set on your system (e.g. PATH). We should be 
able to help a bit more. Not me since I don’t know much about Windows, but 
someone will…

hth

- Tom


> 
> At this point in my Django career, I am pretty much a monkey banking on a 
> keyboard when troubleshooting this type of issue.   On that note, can you 
> possible refer me to any program/documentation on how I would troubleshoot 
> such an issue (stepping through code, checking variable values, etc).
> 
> If and when I get this up and running, I'll have to put all of the info 
> somewhere, for other peoples' reference.  
> 
> Ivan  
> 
> On Thursday, November 20, 2014 9:38:09 AM UTC-5, Thomas wrote:
> 
> On Nov 19, 2014, at 2:24 PM, jogaserbia  wrote: 
> 
> > Thanks for the help Carl.  Also, thanks for filing the ticket. 
> > 
> > Every bit of info helps.  I really do like Python and Django so far.   
> > 
> > I am just wondering whether I should just quit trying to make GeoDjango 
> > work on my windows machine (at work).  I will be setting up a linux machine 
> > at home in the next couple of months, and can try it out again.   
> 
> Windows boxes can be cranky and annoying, but I’d stick with it and just Make 
> It Work. Once you have a complete installation (and document how you got 
> there!) you won’t have to think hard about it again. Or use virtualbox (and 
> Docker on top of it) to get started with your Linux installation now. 
> 
> You *are* using virtualenv, right? That is very high on my list of things 
> that make my life easier for setting up development systems and deploying to 
> production. You may find that it helps with some of the issues you are seeing 
> on your system. 
> 
> > As a workaround, what I could probably do (if I can figure it out) is call 
> > the postgres fuctions for distance between Lon Lat points that will serve 
> > as the basis for the application that I am building.   
> 
> Yeah, I wrote that code back in the day and I would use GeoDjango. Not that 
> it doesn’t do what it says it does, but GeoDjango gives you everything you 
> will need all at once. 
> 
> hth 
> 
> - 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/fa610d6b-352e-411b-b831-1540b2c67724%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Please consider the environment before printing this message.
This message may be privileged and/or confidential, and the sender does not 
waive any related rights and obligations.  Any distribution, use or copying of 
this message or the information it contains by other than an intended recipient 
is unauthorized.  If you received this message in error, please immediately 
advise me by return e-mail or phone.  All information, references, images, 
programs, source code, or other materials whatsoever contained in, or supplied 
with, this document are TRADE SECRETS and governed by the Uniform Trade Secrets 
Act.  User assumes all direct and consequential liabilities and costs that 
result from any unauthorized disclosure or use of this information.

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


Re: Replacing usage of form._errors in Django 1.7

2014-11-20 Thread Alasdair Nicol

Hi Collin,

On 17/11/14 21:19, Collin Anderson wrote:

Hi Alasdair,

I'm upgrading to Django 1.7, and updating my forms to use the new
form.add_errors() method.

I have one remaining pattern which uses form._errors.

class MyForm(forms.Form):
  ...
  def clean():
 cleaned_data = super(MyForm, self).clean()
 if not self._errors:
 do_something()

I only want to call do_something() if no errors have been found during
the validation so far. I'd rather not use self._errors, since it is now
a private API according to the release notes [1]. What's the
recommended
way to replace self._errors here?

Is it ok to use self.errors instead? Looking at the source code [2],
errors is a property, not an attribute. By the time the clean() method
is called, self._errors should have been created, so I think that
accessing self.errors should be safe.


The doc says it's ok.
"Since the field validation methods have been run by the time clean() is
called, you also have access to the form’s errors attribute which
contains all the errors raised by cleaning of individual fields."

https://docs.djangoproject.com/en/dev/ref/forms/validation/#form-subclasses-and-modifying-field-errors



Thanks for your reply, and your link to the docs. I can go ahead and 
replace my occurrences of self._errors with self.errors with confidence :)


Cheers,
Alasdair

--
Alasdair Nicol
Developer, MEMSET

mail: alasd...@memset.com
 web: http://www.memset.com/

Memset Ltd., registration number 4504980.
Building 87, Dunsfold Park, Stovolds Hill, Cranleigh, Surrey, GU6 8TB, UK

--
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/546E0B87.7050001%40memset.com.
For more options, visit https://groups.google.com/d/optout.


Re: default login template not found (registration/login.html)

2014-11-20 Thread 顏大剛
I got it, thank you.

Yen

2014-11-20 20:18 GMT+08:00 Daniel Roseman :

> On Thursday, 20 November 2014 11:39:09 UTC, Yen wrote:
>>
>> Hi,
>>
>> I follow the doc to test the login system. I set a view function with
>> @login_required to show successful login message.
>>
>> In the html, a link like:
>> Login
>>
>> The URLconf under 'account' namespace contains one url:
>> url(r'^login/$', 'django.contrib.auth.views.login', name='login',)
>>
>>
>> It shows the exceptions, and I show the traceback here:
>>
>>
>>
>>
>>
>>
>>
>> *Template Loader Error:Django tried loading these templates, in this
>> order:Using loader django.template.loaders.filesystem.Loader:> project>/templates/registration/login.html (File does not exist)Using
>> loader
>> django.template.loaders.app_directories.Loader:/usr/local/lib/python3.2/dist-packages/django/contrib/admin/templates/registration/login.html
>> (File does not
>> exist)/usr/local/lib/python3.2/dist-packages/django/contrib/auth/templates/registration/login.html
>> (File does not exist)*
>> I found one login.html in 'django/contrib/admin/
>> templates/admin/login.html'.
>> Is it a bug or I miss something?
>>
>> Yen
>>
>
> There is no default login template. If you want a login form, you need to
> provide a template. See the docs at
> https://docs.djangoproject.com/en/1.7/topics/auth/default/#django.contrib.auth.views.login
> :
> "It’s your responsibility to provide the html for the login template ,
> called registration/login.html by default."
> --
> DR.
>
> --
> 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/94f9570d-e9dc-48da-8571-85a2eb3dc984%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFnq%3D1iExGvd9e1LKk5mJM%3D0bQvccRkhBK9h-F_poBZgnEz_sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Managing a database connection object in Django

2014-11-20 Thread Ankit Arora


I'm working with a Postgresql database with Django. Because of licensing 
reasons, I can't use psycopg2 , so I'm using the alternative pygresql.

I don't need to use the Django ORM at all, I simply need the cursor for 
cur.execute() and cur.fetchall().

Since pygresql doesn't have a Django backend connector, I can't use the 
pygresql pgdb module in the Database settings in settings.py; I've to 
manually open up a connection object.

What would be the best practice to do this? Currently I've simply created 
the connection object conn=pgdb.connect(params) in views.py outside of all 
functions, but this seems a bit hacky and I do get 'ProgrammingError: 
Server Closed the connection unexpectedly' errors here and there.

One approach might be to simply create an executeQuery() function which 
Opens a connection, executes a query, and closes it each time I want to 
execute a query. But I'm not sure if that's best practice and whether it 
would cause any issues.

Any tips?

-- 
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/8ce2851a-7793-4bba-9761-3a4ba0cbf066%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Form doesn't show in HTML template

2014-11-20 Thread Some Developer
I'm having a bit of a perplexing issue with Django 1.7.1 running on Arch 
Linux using Python 3.4.2. If it matters I'm using Pycharm 3.4 as my IDE.


I have the following Python modules installed in my virtualenv:

bcrypt
boto
braintree
cffi
django-braces
django-debug-toolbar
psycopg2
pycparser
requests
six
sqlparse

I have a FormView which takes a Django form object (not a ModelForm) and 
tries to display a form. But when I view the template in a browser the 
form itself is not shown.


At first I thought that for some reason the form context object was not 
being passed to the template but I checked the template context object 
(via django-debug-toolbar) and the form context variable is available in 
the template and is the correct object.


I've tried various things including changing the view to a CreateView 
object and obviously changing the form to ModelForm which does display 
the form but for various reasons I'd rather have just a standard form 
rather than a ModelForm and use FormView.


Here is the code in question:

http://dpaste.com/1S6W861

I have absolutely no idea what the problem is. Pretty much the same code 
worked perfectly on Python 2.7.x and the only difference I can see is 
that I am now using Python 3.4.x but I'm positive this can't be the 
issue as it would have been picked up way before now.


Any help is appreciated as I'm finding this really perplexing.

If I've left anything out that would be useful let me know and I'll post 
the information up.


--
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/546E4E63.60207%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-20 Thread James Schneider
Dumb question, but there is a "main_content" block in base.html, right?

I'm assuming the "Please register..." message shows but the form doesn't?
Or does that message not show up?

-James
On Nov 20, 2014 12:26 PM, "Some Developer" 
wrote:

> I'm having a bit of a perplexing issue with Django 1.7.1 running on Arch
> Linux using Python 3.4.2. If it matters I'm using Pycharm 3.4 as my IDE.
>
> I have the following Python modules installed in my virtualenv:
>
> bcrypt
> boto
> braintree
> cffi
> django-braces
> django-debug-toolbar
> psycopg2
> pycparser
> requests
> six
> sqlparse
>
> I have a FormView which takes a Django form object (not a ModelForm) and
> tries to display a form. But when I view the template in a browser the form
> itself is not shown.
>
> At first I thought that for some reason the form context object was not
> being passed to the template but I checked the template context object (via
> django-debug-toolbar) and the form context variable is available in the
> template and is the correct object.
>
> I've tried various things including changing the view to a CreateView
> object and obviously changing the form to ModelForm which does display the
> form but for various reasons I'd rather have just a standard form rather
> than a ModelForm and use FormView.
>
> Here is the code in question:
>
> http://dpaste.com/1S6W861
>
> I have absolutely no idea what the problem is. Pretty much the same code
> worked perfectly on Python 2.7.x and the only difference I can see is that
> I am now using Python 3.4.x but I'm positive this can't be the issue as it
> would have been picked up way before now.
>
> Any help is appreciated as I'm finding this really perplexing.
>
> If I've left anything out that would be useful let me know and I'll post
> the information up.
>
> --
> 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/546E4E63.60207%40googlemail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWD4b9ofTWgS9EYp%2BLc4d2OdfgzZrcPDg6ZaKRG30SZjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Could not import settings

2014-11-20 Thread Larry Martell
I am setting up a new django project and I'm getting the dreaded
'Could not import settings' error. I've set up many django projects
before, and never had this problem. The differences with this one is
that it's using python3.4, django 1.7, and it's on a VM (all my others
were on <1.7, python 2 and a physical host). I've googled this and
it's asked a lot, but none of the solutions work for me.

This is the error I'm getting:

vagrant@vagrant:/vagrant/elex_apis$ python3 manage.py migrate
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 94, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2231, in _gcd_import
  File "", line 2214, in _find_and_load
  File "", line 2189, in _find_and_load_unlocked
  File "", line 321, in _call_with_frames_removed
  File "", line 2231, in _gcd_import
  File "", line 2214, in _find_and_load
  File "", line 2201, in _find_and_load_unlocked
ImportError: No module named '/vagrant/elex_apis/elex_apis/settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py",
line 385, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python3.4/dist-packages/django/core/management/__init__.py",
line 345, in execute
settings.INSTALLED_APPS
  File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 46, in __getattr__
self._setup(name)
  File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 42, in _setup
self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.4/dist-packages/django/conf/__init__.py",
line 98, in __init__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings
'/vagrant/elex_apis/elex_apis/settings.py' (Is it on sys.path? Is
there an import error in the settings file?): No module named
'/vagrant/elex_apis/elex_apis/settings'


I'm checked all the usual things (The settings file is there, it's
readable, I have an __init__,py file, my wsgi.py is good, my manage.py
is good, and I can import it)

vagrant@vagrant:/vagrant/elex_apis$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import elex_apis.settings
>>>


Any assistance will be greatly appreciated.

-- 
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/CACwCsY6mb3xsYDnqZ%2B6j87mydevD6VNYrfTifsiCVttfktQjyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-20 Thread Some Developer

On 20/11/14 21:15, James Schneider wrote:

Dumb question, but there is a "main_content" block in base.html, right?

I'm assuming the "Please register..." message shows but the form
doesn't? Or does that message not show up?

-James



Yes main_content block exists and the page displays the forms submit 
button and the "Please register..." text just fine. The only thing that 
is not displayed is the email, password and password_confirm form fields 
in the form object which is strange. Even the csrf_token displays fine 
(which I forgot to add to the source code I posted on dpaste).


--
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/546E5F8F.9070101%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-20 Thread Vijay Khemlani
If you set the settings TEMPLATE_DEBUG to True, does it display any errors?

On Thu, Nov 20, 2014 at 6:39 PM, Some Developer 
wrote:

> On 20/11/14 21:15, James Schneider wrote:
>
>> Dumb question, but there is a "main_content" block in base.html, right?
>>
>> I'm assuming the "Please register..." message shows but the form
>> doesn't? Or does that message not show up?
>>
>> -James
>>
>>
> Yes main_content block exists and the page displays the forms submit
> button and the "Please register..." text just fine. The only thing that is
> not displayed is the email, password and password_confirm form fields in
> the form object which is strange. Even the csrf_token displays fine (which
> I forgot to add to the source code I posted on dpaste).
>
> --
> 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/546E5F8F.9070101%40googlemail.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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1K0vJ%2BEdoypoW3jX4yviNYSid%3DT9jrAS0T4YiUs2WfaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-20 Thread Some Developer

On 20/11/14 22:07, Vijay Khemlani wrote:

If you set the settings TEMPLATE_DEBUG to True, does it display any errors?



No.

--
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/546E66D9.6080803%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Trying to use django-locking (I know it's old)

2014-11-20 Thread ian . k
Hi there,

I'd like to try and add django-locking 
(https://github.com/RobCombs/django-locking) to my Django project's admin 
page. (version 1.6.8)

I've installed the egg file and fixed an import statement that used 
deprecated code. When running step 7 of the installation steps (see github 
page above), it's complaining now that my settings object has no ADMIN_URL 
attribute. I can't find any documentation about how to properly set this 
attribute, or if it's out of date, what to replace it with. The actual 
exception is this:

  File 
"/usr/local/lib/python2.7/dist-packages/django_locking-0.3.2-py2.7.egg/locking/admin.py",
 
line 15, in 
class LockableAdmin(admin.ModelAdmin):
  File 
"/usr/local/lib/python2.7/dist-packages/django_locking-0.3.2-py2.7.egg/locking/admin.py",
 
line 17, in LockableAdmin
class Media:
  File 
"/usr/local/lib/python2.7/dist-packages/django_locking-0.3.2-py2.7.egg/locking/admin.py",
 
line 21, in Media
_s.ADMIN_URL + "ajax/variables.js",
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", 
line 55, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'ADMIN_URL'


Please help if you can. Thanks!
- Ian

-- 
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/f9a2a283-7f4e-47f9-9c95-424d5e593b59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to use django-locking (I know it's old)

2014-11-20 Thread ian . k
*I have since fixed the above issue, but am encountering another one.*

It's now saying in the console:
Not Found: /admin/ajax/test/common/configuration/1/is_locked/

But, entering /admin/ajax/test/common/configuration/1/ into a browser is 
working perfectly - showing me the first Configuration item in my project. 

Do you know what could be causing this? The other parts of the added code 
seem to be located just fine.

Thanks!
Ian



On Thursday, November 20, 2014 11:02:29 AM UTC-7, ia...@me.com wrote:
>
> Hi there,
>
> I'd like to try and add django-locking (
> https://github.com/RobCombs/django-locking) to my Django project's admin 
> page. (version 1.6.8)
>
> I've installed the egg file and fixed an import statement that used 
> deprecated code. When running step 7 of the installation steps (see github 
> page above), it's complaining now that my settings object has no ADMIN_URL 
> attribute. I can't find any documentation about how to properly set this 
> attribute, or if it's out of date, what to replace it with. The actual 
> exception is this:
>
>   File 
> "/usr/local/lib/python2.7/dist-packages/django_locking-0.3.2-py2.7.egg/locking/admin.py",
>  
> line 15, in 
> class LockableAdmin(admin.ModelAdmin):
>   File 
> "/usr/local/lib/python2.7/dist-packages/django_locking-0.3.2-py2.7.egg/locking/admin.py",
>  
> line 17, in LockableAdmin
> class Media:
>   File 
> "/usr/local/lib/python2.7/dist-packages/django_locking-0.3.2-py2.7.egg/locking/admin.py",
>  
> line 21, in Media
> _s.ADMIN_URL + "ajax/variables.js",
>   File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", 
> line 55, in __getattr__
> return getattr(self._wrapped, name)
> AttributeError: 'Settings' object has no attribute 'ADMIN_URL'
>
>
> Please help if you can. Thanks!
> - Ian
>

-- 
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/e8b4489a-4fc2-4259-ab5e-0c926b1e46c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-20 Thread Fred Stluka

termopro,

I have automated my deployments mostly separate from my
version control.

The other team members and I write, test, commit, and push our
code changes to our Git repo.  I then pull, review, test, update
the version number, commit, tag, and push to Git.

Then I use a shell script (on Mac, but would work on Unix/Linux
also) to push the tagged commit to TEST and later to PROD.

My script does things like:

- Get the latest files from Git before, and back to master after:
   % git checkout mytag
   ...
   % git checkout master

- Create folder of collected static files before, and delete after:
   % mkdir -pv collected_static/mytag
   % python manage.py collectstatic --clear --noinput
   ...
   % rm -rfv collected_static

- Delete all local *.pyc files:
   % find . -name \*.pyc -exec rm -v "{}" ";"

- Insert PROD password into local settings file (PROD pushes
   only) before, and remove after:
   % sed -i .old -e "s/PUT_PROD_PASSWORD_HERE/`cat prod_pw`/g" settings.py
   ...
   % mv -v settings.py.old settings.py

- Show a warning banner at the Web site to say it is going down
   briefly, and clear the banner after:
   % ssh -t myserver.mydomain.com cp -v 
/var/www/django/myapp/templates/myapp/site_alert_maintenance.html 
site_alert.html

   % sleep 60
   ...
   % ssh -t myserver.mydomain.com cp -v 
/var/www/django/myapp/templates/myapp/site_alert_none.html site_alert.html


- Push the local files to the TEST or PROD server:
   %  rsync -v --progress -i -l --rsh=ssh -r --del myapp 
myserver.mydomain.com:/var/www/django


- Run all migrations on the server
   % ssh -t myserver.mydomain.com python manage.py migrate --all

- Stop the Apache server, delete all remote *.pyc files, and
   restart the server:
   % ssh -t myserver.mydomain.com sudo /etc/init.d/httpd stop
   % ssh -t myserver.mydomain.com sudo find /var/www/django/myapp -name 
\*.pyc -exec rm -v "{}" ";"

   % ssh -t myserver.mydomain.com sudo /etc/init.d/httpd start

Plus a few other actions that are specific to our app, and lots
or informational messages, prompts, confirmations, etc.  Also,
some of these steps are combined into a remote script that
runs on the server to reduce the number of "ssh -t sudo"
commands I would otherwise have to do.  But, that's the gist
of it.

Hope this helps!
--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/19/14 5:22 AM, termopro wrote:


I have created a Django 1.7 project and would like to deploy it. I am 
reading about how to do it right and i have some questions.


If i understand correctly deployment should contain the following steps:

1) Initial remote machine set up:

  * a) install os / server / database / cache ...
  * b) install Django and required modules
  * c) update database with real data

2) Upload code/ database changes to remote machine:

  * a) upload changed Django project
  * b) upload changes in Database tables (model migrations)

Most tutorials/articles about deployment do not cover 1.c and 2.b. 
Also the tasks 1.b. and 2.a. are solved using revision control tools 
(Git/Mercurial)


So i'd like to know:

 *

1) How do i install Django project or it's updates without
revision control tools ? Should i simply upload my project using
FTP/SSH ? Is there a good way to automate it ?

 *

2) How do i automate the task of uploading required database
changes (like model migrations) ?

--
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/e9fb8f5a-2bd9-47d5-80c7-07a3aa82bd25%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/546E7B4A.3030303%40bristle.com.
For more options, visit

traceback when encountering unhandled exception and trying to send email

2014-11-20 Thread Etienne Le Sueur
Hi Django users,

has anyone seen a similar traceback to this:

2014-11-20 14:48:14.190659500 gunicorn[20952]: ERROR: Error handling request
2014-11-20 14:48:14.190661500 Traceback (most recent call last):
2014-11-20 14:48:14.190661500   File 
"/build/toolchain/noarch/gunicorn-18.0/lib/python2.7/site-packages/gunicorn/workers/sync.py",
 
line 131, in handle_request
2014-11-20 14:48:14.190662500 respiter = self.wsgi(environ, 
resp.start_response)
2014-11-20 14:48:14.190662500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
 
line 206, in __call__
2014-11-20 14:48:14.190674500 response = self.get_response(request)
2014-11-20 14:48:14.190674500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/handlers/base.py",
 
line 194, in get_response
2014-11-20 14:48:14.190675500 response = 
self.handle_uncaught_exception(request, resolver, sys.exc_info())
2014-11-20 14:48:14.190675500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/handlers/base.py",
 
line 224, in handle_uncaught_exception
2014-11-20 14:48:14.190678500 'request': request
2014-11-20 14:48:14.190678500   File 
"/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
line 1175, in error
2014-11-20 14:48:14.190678500 self._log(ERROR, msg, args, **kwargs)
2014-11-20 14:48:14.190679500   File 
"/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
line 1268, in _log
2014-11-20 14:48:14.190682500 self.handle(record)
2014-11-20 14:48:14.190683500   File 
"/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
line 1278, in handle
2014-11-20 14:48:14.190683500 self.callHandlers(record)
2014-11-20 14:48:14.190683500   File 
"/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
line 1318, in callHandlers
2014-11-20 14:48:14.190684500 hdlr.handle(record)
2014-11-20 14:48:14.190686500   File 
"/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
line 749, in handle
2014-11-20 14:48:14.190686500 self.emit(record)
2014-11-20 14:48:14.190686500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/log.py",
 
line 122, in emit
2014-11-20 14:48:14.190687500 connection=self.connection())
2014-11-20 14:48:14.190687500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/log.py",
 
line 125, in connection
2014-11-20 14:48:14.190689500 return 
get_connection(backend=self.email_backend, fail_silently=True)
2014-11-20 14:48:14.190689500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/mail/__init__.py",
 
line 29, in get_connection
2014-11-20 14:48:14.190690500 klass = import_by_path(backend or 
settings.EMAIL_BACKEND)
2014-11-20 14:48:14.190690500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/module_loading.py",
 
line 21, in import_by_path
2014-11-20 14:48:14.190700500 module = import_module(module_path)
2014-11-20 14:48:14.190700500   File 
"/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/importlib.py",
 
line 41, in import_module
2014-11-20 14:48:14.190701500 return sys.modules[name]
2014-11-20 14:48:14.190701500 KeyError: 'django.core.mail.backends.smtp'
2014-11-20 14:48:14.190861500 gunicorn[20952]: INFO: GET / HTTP/1.0 |  | - 
| 500 | 0s

Django clear tries to access a module that hasn't been loaded yet.

It is quite possibly a configuration error. Here are some sections from 
settings.py:

 97 MIDDLEWARE_CLASSES = (
 98 'django.middleware.common.CommonMiddleware',
 99 'django.contrib.sessions.middleware.SessionMiddleware',
100 'django.middleware.csrf.CsrfViewMiddleware',
101 'django.contrib.auth.middleware.AuthenticationMiddleware',
102 'django.contrib.messages.middleware.MessageMiddleware',
103 )


119 INSTALLED_APPS = (
120 'django.contrib.admin',
121 'django.contrib.auth',
122 'django.contrib.contenttypes',
123 'django.contrib.sessions',
124 'django.contrib.sites',
125 'django.contrib.messages',
126 'django.contrib.staticfiles',
127 'recommend',
128 'tastypie',
129 'gunicorn',
130 )

139 LOGGING = {
140 'version': 1,
141 'disable_existing_loggers': False,
142 'filters': {
143 'require_debug_false': {
144 '()': 'django.utils.log.RequireDebugFalse'
145 }
146 },
147 'formatters': {
148 'simple': {
149 'format': '%(levelname)s %(message)s',
150 },
151 },
152 'handlers': {
153 'mail_admins': {
154 'level': 'ERROR',
155 'filters': ['require_debug_false'],
156 'class': 'django.utils.log.AdminEmailHandler'
157 },
158 'console': {
159 'level': 'DEBUG',
160 'class': 'logging.StreamHandler',
161 

Re: Advice needed: Adaptive/Responsive Images in Django?

2014-11-20 Thread Fred Stluka

Right.  Very good article.

The gist is to use the new HTML5 "" and ""
elements along with the "sizes" and "srcset" attributes of
"", and perhaps the CSS3 "calc()" function to specify
multiple sizes of the same image, so the browser only
downloads the right one for the current screen size, all in
a way that falls back to slower but acceptable for older
browsers.

BTW, if you're willing to throw a little JavaScript into the mix,
and not limit yourself to just CSS, you can do truly amazing
things with RWD (Responsive Web Design).  I've been doing
it for about 14 years.  See, for example:
- http://bristle.com/RWD/BrightPanelsDemo/
Drag the window wider and narrower and watch the panels
completely re-configure themselves, nesting/un-nesting,
stacking/un-stacking, hiding/showing, etc.  Anything is
possible.

--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/20/14 8:55 AM, Patrick Beeson wrote:
AListApart recently published a great article on responsive 
images: http://alistapart.com/article/responsive-images-in-practice


On Thursday, November 20, 2014 1:05:45 AM UTC-5, ThomasTheDjangoFan 
wrote:


Hi guys,

do you have a tip for implementing adaptive (responsive) images in
django?

Basically I want to server smaller images to mobile-users and
bigger images to desktop users.
I don't really now about best practices for SEO and
Siteload-Performance.

Are there any apps that you can recon for this?

Thanks a lot for your tips!

Kind regards
Thomas

--
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/0ea0a557-8043-4bfa-bc2f-23c2561e2245%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/546E80DB.1010503%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-20 Thread Phang Mulianto
Hi termopro,

TO automate the deployment, look for fabric + cuisie (CHef like fabric) .

You will bored with the command line in each deployment, and you will need
fast and standard way of deploying to each new machine.

Fred way is good, but need time to type and remember all the steps. WIth
fabric you will not miss a step and it can be automated.

Git is you friend here. You can create a private repo in your prod machine,
and make the code pull from the repo for production deployment when you
push from dev to prod with hook script (Automate again)

BUt make sure the code tested before go production with this way.

Regards,

Mulianto

Blog: http://muliantophang.blogspot.com

On Fri, Nov 21, 2014 at 7:37 AM, Fred Stluka  wrote:

>  termopro,
>
> I have automated my deployments mostly separate from my
> version control.
>
> The other team members and I write, test, commit, and push our
> code changes to our Git repo.  I then pull, review, test, update
> the version number, commit, tag, and push to Git.
>
> Then I use a shell script (on Mac, but would work on Unix/Linux
> also) to push the tagged commit to TEST and later to PROD.
>
> My script does things like:
>
> - Get the latest files from Git before, and back to master after:
>% git checkout mytag
>...
>% git checkout master
>
> - Create folder of collected static files before, and delete after:
>% mkdir -pv collected_static/mytag
>% python manage.py collectstatic --clear --noinput
>...
>% rm -rfv collected_static
>
> - Delete all local *.pyc files:
>% find . -name \*.pyc -exec rm -v "{}" ";"
>
> - Insert PROD password into local settings file (PROD pushes
>only) before, and remove after:
>% sed -i .old -e "s/PUT_PROD_PASSWORD_HERE/`cat prod_pw`/g" settings.py
>...
>% mv -v settings.py.old settings.py
>
> - Show a warning banner at the Web site to say it is going down
>briefly, and clear the banner after:
>% ssh -t myserver.mydomain.com cp -v
> /var/www/django/myapp/templates/myapp/site_alert_maintenance.html
> site_alert.html
>% sleep 60
>...
>% ssh -t myserver.mydomain.com cp -v
> /var/www/django/myapp/templates/myapp/site_alert_none.html site_alert.html
>
> - Push the local files to the TEST or PROD server:
>%  rsync -v --progress -i -l --rsh=ssh -r --del myapp
> myserver.mydomain.com:/var/www/django
>
> - Run all migrations on the server
>% ssh -t myserver.mydomain.com python manage.py migrate --all
>
> - Stop the Apache server, delete all remote *.pyc files, and
>restart the server:
>% ssh -t myserver.mydomain.com sudo /etc/init.d/httpd stop
>% ssh -t myserver.mydomain.com sudo find /var/www/django/myapp -name
> \*.pyc -exec rm -v "{}" ";"
>% ssh -t myserver.mydomain.com sudo /etc/init.d/httpd start
>
> Plus a few other actions that are specific to our app, and lots
> or informational messages, prompts, confirmations, etc.  Also,
> some of these steps are combined into a remote script that
> runs on the server to reduce the number of "ssh -t sudo"
> commands I would otherwise have to do.  But, that's the gist
> of it.
>
> Hope this helps!
> --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/19/14 5:22 AM, termopro wrote:
>
>  I have created a Django 1.7 project and would like to deploy it. I am
> reading about how to do it right and i have some questions.
>
> If i understand correctly deployment should contain the following steps:
>
> 1) Initial remote machine set up:
>
>- a) install os / server / database / cache ...
>- b) install Django and required modules
>- c) update database with real data
>
> 2) Upload code/ database changes to remote machine:
>
>- a) upload changed Django project
>- b) upload changes in Database tables (model migrations)
>
> Most tutorials/articles about deployment do not cover 1.c and 2.b. Also
> the tasks 1.b. and 2.a. are solved using revision control tools
> (Git/Mercurial)
>
> So i'd like to know:
>
>-
>
>1) How do i install Django project or it's updates without revision
>control tools ? Should i simply upload my project using FTP/SSH ? Is there
>a good way to automate it ?
> -
>
>2) How do i automate the task of uploading required database changes
>(like model migrations) ?
>
>  --
> 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/e9fb8f5

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-20 Thread Collin Anderson
Hi,

Do other templates work in that folder?

Collin


On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:
>
>
> > Show your view code
> The tutorial did not create any view.py for the admin pages
>
>
>
> See 
> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-look-and-feel
>
> We copied from the Django source files these two into:
> /mysite/templates/admin/base_site.html
> and
> /mysite/templates/admin/index.html
>
>
>
> and in 
> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-the-admin-change-list
> edited:
>
>
> admin.py
>
> from django.contrib import admin
>
> # Register your models here.
>
> from django.contrib import admin
> from polls.models import Choice, Question
>
>
> class ChoiceInline(admin.TabularInline):
> model = Choice
> extra = 3
>
>
> class QuestionAdmin(admin.ModelAdmin):
> fieldsets = [
> (None,   {'fields': ['question_text']}),
> ('Date information', {'fields': ['pub_date'], 'classes': 
> ['collapse']}),
> ]
> inlines = [ChoiceInline]
> list_display = ('question_text', 'pub_date', 'was_published_recently')
> list_filter = ['pub_date']
> search_fields = ['question_text']
>
> admin.site.register(Question, QuestionAdmin)
>
>
> ---
>
>
>
> On Mon, Nov 17, 2014 at 2:11 PM, Artie > 
> wrote:
>
>> Are you sure about correct path to your templates in views?
>>
>> Show your view code
>>
>> понедельник, 17 ноября 2014 г., 5:04:53 UTC+2 пользователь Andreas Ka 
>> написал:
>>>
>>> thanks for your answer.
>>>
>>> yes, I just tried that. Same result.
>>>
>>  
>
>> By now, I have understood much more about the templates.
>>>
>>  
>
>> But still, for the admin pages
>>> mysite/templates/admin/base_site.html   
>>> doesn't work yet.
>>>
>>>
>>> ...
>>>
>>
> On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE  wrote:
>
>> Obviously you've restarted the server and refreshed the page in such a 
>> way to ensure it's not a caching issue ?
>
>
>  
>  
>

-- 
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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.6 admin force db commit

2014-11-20 Thread Collin Anderson
Hi,

Yes, I think the entire admin view is wrapped in @atomic, so I don't think 
it's possible to end the transaction before the view finishes. Maybe you 
could somehow handle it in a middleware?

Collin


On Monday, November 17, 2014 6:38:56 PM UTC-5, PRyan wrote:
>
> I'm trying to force a db commit on our users admin page. I call obj.save() 
> then want to call sync_marketing(obj.id). When sync_marketing pulls the 
> User object from the db by the id, it gets the data before the save, not 
> the data afterwards.
>
> sync_marketing is ran via celery (apply_async) and we really don't want to 
> use countdown to delay it. i need to force the db to commit that save after 
> I call save so then when celery pulls from the db, it is the new data. 
>
> I've tried transaction.savepoint and savepoint_commit, no luck. If i 
> set_autocommit to true (get_autocommit shows False) I get a "forbidden in 
> atomic block" error.
>
> I've tried with and without the atomic decorator. I don't know how to make 
> it non-atomic, if that is the right path, etc.
>
> Any suggestions would 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/361b85e0-0448-4ac8-9c53-22645cda7586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.7 tutorial: python manage.py migrate errors.

2014-11-20 Thread Alvin Panugayan
I'm following the django tutorial online and I'm stuck on the migrate bit 
(bottom of the post).

1. Do I need to install south ? Tried to install but am getting a similar 
error.  OpenKey() argument...
2. Do I need to install sqlite3 separately ? Running import sqlite inside 
the python prompt seems to work, but typing sqlite3 on the windows command 
prompt doesn't work.

C:\Python33\kaizen>python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "C:\Python33\lib\site-packages\django\core\management\__init__.py", 
line 385, in execute_from_command_
utility.execute()
  File "C:\Python33\lib\site-packages\django\core\management\__init__.py", 
line 354, in execute
django.setup()
  File "C:\Python33\lib\site-packages\django\__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
  File "C:\Python33\lib\site-packages\django\apps\registry.py", line 108, 
in populate
app_config.import_models(all_models)
  File "C:\Python33\lib\site-packages\django\apps\config.py", line 202, in 
import_models
self.models_module = import_module(models_module_name)
  File "C:\Python33\lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1584, in _gcd_import
  File "", line 1565, in _find_and_load
  File "", line 1532, in 
_find_and_load_unlocked
  File "", line 584, in _check_name_wrapper
  File "", line 1022, in load_module
  File "", line 1003, in load_module
  File "", line 560, in 
module_for_loader_wrapper
  File "", line 868, in _load_module
  File "", line 313, in 
_call_with_frames_removed
  File "C:\Python33\lib\site-packages\django\contrib\auth\models.py", line 
13, in 
from django.contrib.auth.hashers import (
  File "C:\Python33\lib\site-packages\django\contrib\auth\hashers.py", line 
11, in 
from django.test.signals import setting_changed
  File "C:\Python33\lib\site-packages\django\test\__init__.py", line 6, in 

from django.test.testcases import (
  File "C:\Python33\lib\site-packages\django\test\testcases.py", line 26, 
in 
from django.core.servers.basehttp import WSGIRequestHandler, WSGIServer
  File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", 
line 16, in 
from wsgiref import simple_server
  File "C:\Python33\lib\wsgiref\simple_server.py", line 13, in 
from http.server import BaseHTTPRequestHandler, HTTPServer
  File "C:\Python33\lib\http\server.py", line 654, in 
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
  File "C:\Python33\lib\http\server.py", line 839, in 
SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
  File "C:\Python33\lib\mimetypes.py", line 348, in init
db.read_windows_registry()
  File "C:\Python33\lib\mimetypes.py", line 255, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: OpenKey() argument 2 must be str without null characters or 
None, not str

-- 
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/70792c0f-b500-423a-ab59-9d8c96a09885%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django comments app - adding each field of comments app to div classes

2014-11-20 Thread Code
I am using django comments app and am using bootstrap template for UI. 

In bootstrap I have; 


 Name
 



and other div classes to fill in mame , email, url and comments.


Django comments app's 

{% get_comment_form for post as form %}


allows manually render fields like;

{{form.user_name}}
{{form.user_email}}
etc.


Question: How do I integrate `{{form.user_name}}` and other fields in the 
div class?

Thanks for your help.

-- 
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/1867ba77-038f-4edf-be4a-8b59a20c265a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django comments app - adding each field of comments app to div classes

2014-11-20 Thread Code
Also, is there a better alternative to comments app? thanks

On Friday, 21 November 2014 09:10:40 UTC+5:30, Code wrote:
>
> I am using django comments app and am using bootstrap template for UI. 
>
> In bootstrap I have; 
>
> 
>  Name
>   value="" aria-required="true" placeholder="Your Name">
> 
>
>
> and other div classes to fill in mame , email, url and comments.
>
>
> Django comments app's 
>
> {% get_comment_form for post as form %}
>
>
> allows manually render fields like;
>
> {{form.user_name}}
> {{form.user_email}}
> etc.
>
>
> Question: How do I integrate `{{form.user_name}}` and other fields in the 
> div class?
>
> Thanks for your help.
>

-- 
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/0e8aa43e-7f18-4417-80de-6fd962d7ce21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


problem implementing admin inline

2014-11-20 Thread yakkadesign
I have a  model that has a foreignKey to a  model.  I want 
to be able to edit the  model within the  admin

in moduleApp.models I have something like:
class module(models.Model):
  HTML = models.TextField( blank=True, null=True )

in articleApp.models I have something like:
class article(models.Model)
  HomePageModule = models.ForeignKey(module, blank=True, null=True)

In the admin I have something:
class moduleInline(admin.TabularInline):
model = module

class ArticleAdmin(admin.ModelAdmin):
inlines = [moduleInline,]

I'm getting the error XXX has no ForeignKey to XXX.

I've found a few other people with the problem and it seems like the 
problem is that I need to change up the moduleInline to articleInline.
http://stackoverflow.com/questions/21899523/inline-in-django-admin-has-no-foreignkey
http://stackoverflow.com/questions/8526159/django-inline-has-no-foreignkey-to

I'm trying to keep my moduleApp as a stand alone app and use it in multiple 
other apps.  To achieve this I'll have to move all the admin code in the 
module app.  This defeats my desire to make moduleApp a stand alone app.  

Is there a way I can make inlines work for this?  If not, what is the best 
way to get this done?  I've got a highly customized admin so I don't mind 
making the edits.  

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/02d1f2b1-99a0-40d0-803a-d440d370c433%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.7 tutorial: python manage.py migrate errors.

2014-11-20 Thread Daniel França
If you are using Django 1.7 why don't you use the built in migrations:
https://docs.djangoproject.com/en/dev/topics/migrations/
On Fri 21 Nov 2014 at 05:19 Alvin Panugayan  wrote:

> I'm following the django tutorial online and I'm stuck on the migrate bit
> (bottom of the post).
>
> 1. Do I need to install south ? Tried to install but am getting a similar
> error.  OpenKey() argument...
> 2. Do I need to install sqlite3 separately ? Running import sqlite inside
> the python prompt seems to work, but typing sqlite3 on the windows command
> prompt doesn't work.
>
> C:\Python33\kaizen>python manage.py migrate
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "C:\Python33\lib\site-packages\django\core\management\__init__.py",
> line 385, in execute_from_command_
> utility.execute()
>   File "C:\Python33\lib\site-packages\django\core\management\__init__.py",
> line 354, in execute
> django.setup()
>   File "C:\Python33\lib\site-packages\django\__init__.py", line 21, in
> setup
> apps.populate(settings.INSTALLED_APPS)
>   File "C:\Python33\lib\site-packages\django\apps\registry.py", line 108,
> in populate
> app_config.import_models(all_models)
>   File "C:\Python33\lib\site-packages\django\apps\config.py", line 202, in
> import_models
> self.models_module = import_module(models_module_name)
>   File "C:\Python33\lib\importlib\__init__.py", line 90, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1584, in _gcd_import
>   File "", line 1565, in _find_and_load
>   File "", line 1532, in
> _find_and_load_unlocked
>   File "", line 584, in _check_name_wrapper
>   File "", line 1022, in load_module
>   File "", line 1003, in load_module
>   File "", line 560, in
> module_for_loader_wrapper
>   File "", line 868, in _load_module
>   File "", line 313, in
> _call_with_frames_removed
>   File "C:\Python33\lib\site-packages\django\contrib\auth\models.py", line
> 13, in 
> from django.contrib.auth.hashers import (
>   File "C:\Python33\lib\site-packages\django\contrib\auth\hashers.py",
> line 11, in 
> from django.test.signals import setting_changed
>   File "C:\Python33\lib\site-packages\django\test\__init__.py", line 6, in
> 
> from django.test.testcases import (
>   File "C:\Python33\lib\site-packages\django\test\testcases.py", line 26,
> in 
> from django.core.servers.basehttp import WSGIRequestHandler, WSGIServer
>   File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py",
> line 16, in 
> from wsgiref import simple_server
>   File "C:\Python33\lib\wsgiref\simple_server.py", line 13, in 
> from http.server import BaseHTTPRequestHandler, HTTPServer
>   File "C:\Python33\lib\http\server.py", line 654, in 
> class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
>   File "C:\Python33\lib\http\server.py", line 839, in
> SimpleHTTPRequestHandler
> mimetypes.init() # try to read system mime.types
>   File "C:\Python33\lib\mimetypes.py", line 348, in init
> db.read_windows_registry()
>   File "C:\Python33\lib\mimetypes.py", line 255, in read_windows_registry
> with _winreg.OpenKey(hkcr, subkeyname) as subkey:
> TypeError: OpenKey() argument 2 must be str without null characters or
> None, not str
>
> --
> 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/70792c0f-b500-423a-ab59-9d8c96a09885%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACPst9JGDp4kKu5%2BbxCqFg8jqBUSAwLMXerpYoqNfHqg_trGWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django.contrib.comments depreciated, any good alternatives?

2014-11-20 Thread Code
Hi,

I have been facing a nightmare with django comments app.

see: https://groups.google.com/forum/#!topic/django-users/7B2umISG-9I

I found out it has been depreciated and so wanted to know suitable 
alternatives. Disqus is one but is this suitable for local environment, I 
am a beginner so need a little help with this. Also, Are there any other 
good alternatives?  

Thanks,
Ric

-- 
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/32ede709-7d25-43e8-9528-8613287418d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.