Re: Django migrations taking all the memory on Django 1.9

2016-09-08 Thread andrea crotti
Ah ok thanks, well generally it's not a blocker, except that we first have 
to upgrade to 1.10.

We have done a lot of migrations in the last few months and given the size 
of the project it always takes a long time from one version to the other, 
so just not sure when I'll be able to test these changes on our project..

On Tuesday, September 6, 2016 at 5:02:24 PM UTC+1, Tim Graham wrote:
>
> Per our support versions policy, Django 1.9.x is only receiving fixes for 
> security and data loss issues. Migrations optimizations are unlikely to 
> qualify for a backport to Django 1.10.x either. Hopefully that doesn't 
> demotivate you from contributing an improvement.
>
>
> https://docs.djangoproject.com/en/dev/internals/security/#supported-versions
>
> On Monday, September 5, 2016 at 9:55:30 AM UTC-4, andrea crotti wrote:
>>
>> Thanks Marcus and others, this issue is in general getting worse and 
>> worse.
>>
>> We did some more investigation and we should probably just help out the 
>> work you are doing.
>>
>> Do you think it would be possible to apply these changes also on Django 
>> 1.9.9 or it has to be from master/1.10 only?
>>
>> I also tried another approach:
>> - use "./manage.py sqlmigrate  " to generate the SQL
>> - add in the generated SQL the INSERT to django_migrations
>> - run the SQL manually in the DB
>>
>> This actually works and could be automated, but I'm quite sure it's not a 
>> good idea..
>> But what do you think could go wrong with this approach?
>>
>> I would say that as long as the dependencies are met and things are done 
>> in the right order it might be safe enough, but of course we get into muddy 
>> waters..
>>
>> On Monday, August 8, 2016 at 2:36:23 PM UTC+1, Tim Graham wrote:
>>>
>>> I think that error suggests that you disabled migrations for an app 
>>> (something_else) that's a dependency of another app that doesn't have 
>>> migrations disabled (something). That isn't permitted. I guess there's no 
>>> good solution for your requirements as of now.
>>>
>>> On Monday, August 8, 2016 at 6:02:48 AM UTC-4, andrea crotti wrote:

 Since we also use --keepdb I thought we could simply avoid running all 
 the migrations, and maybe dynamically even skip all the apps that were not 
 changed at all. 

 So I just tried something silly like this:


 NO_MIGRATIONS = os.environ.get('NO_MIGRATIONS', 'false').lower() in 
 ('true', '1')
 if NO_MIGRATIONS:
 for app in INSTALLED_APPS:
 if app not in MIGRATION_MODULES:
 MIGRATION_MODULES[app] = None


 But I get this error:

 django.db.migrations.exceptions.NodeNotFoundError: Migration 
 something.0001_initial dependencies reference nonexistent parent node 
 ('something_else', u'0001_initial')

 So I guess it's not as simple (and maybe that ticket is what that's 
 about, but sadly it's not even merged in master now from my understanding).

 PS. so to clarify our tests do rely on migrations (and there are some 
 data migrations too) but since we normally use --keepdb anyway we 
 definitively not need to run only a few migrations at a time max (and even 
 then sometimes it takes ages and uses all the RAM).

 On Saturday, August 6, 2016 at 4:03:50 PM UTC+1, Tim Graham wrote:
>
> As long as your tests don't rely on any data migrations, you can set 
> MIGRATIONS_MODULES['app'] = None for all apps in a test settings file as 
> described in 
> https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-MIGRATION_MODULES
>  
> to disable migrations while testing. There's a ticket to make that a bit 
> easier: https://code.djangoproject.com/ticket/25388
>
> On Saturday, August 6, 2016 at 6:07:04 AM UTC-4, andrea crotti wrote:
>>
>>
>> Ok great thanks for the answer Markus.
>> And yes I can try to help, it's quite a big issue for us..
>> Anything else we can do to improve the situation in the meanwhile?
>>
>> In general I was wondering why do we need to handle all the "baggage" 
>> of supporting backward migrations and doing things 100% properly while 
>> running migrations just for tests.
>>
>> I think that in general if there was just a way to render all the SQL 
>> that needs to be run statically for tests it would be great.
>>
>> On Friday, August 5, 2016 at 11:07:56 AM UTC+1, andrea crotti wrote:
>>>
>>> We have a very big Django project with > 100 apps and > 300 models.
>>> We had some massive issues with Django 1.8 and migrations, which 
>>> would take forever and just take all the computer memory after a while.
>>>
>>> Now with Django 1.9 things improved, however we are again back with 
>>> some extremely bad performances and massive memory usages (up to 8GB of 
>>> RAM 
>>> for example), sometimes just to run ONE single migration.
>>>
>>> It's not even enti

Re: multiple django installation in one server

2016-09-08 Thread m1chael
virtual environments and virtual hosts through your web server

On Wed, Sep 7, 2016 at 9:28 AM, miarisoa sandy 
wrote:

> Hi guys,
>
> I hope you are doing fine.
> I have googled it but no fruitful results.
> I am a newbie in django and I wonder what is the number maximum django
> that I can install in one server??
> I have a lot of projects that I would like to check with django ( one
> project -> one django) to avoid some confusion with each project (PHP
> project).
> Or what is the best way for me??
>
> The server is: Ubuntu 12.04, intel core i5 3.2Ghz, 4Go of RAM
>
> Waiting to hear from you, thanks for your help.
>
> Best
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/33008438-92bf-4283-ab52-b6909eb81193%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Python post to remote host

2016-09-08 Thread alireza Rahmani khalili



down votefavorite 


Hi I want to write robot to register in toefl test , I send request to 
remote web site as:

from django.http import HttpResponse
import requests
from bs4 import BeautifulSoupfrom django.middleware import csrf

def index(request):
session = requests.Session()
page = 
session.get('https://toefl-registration.ets.org/TOEFLWeb/extISERLogonPrompt.do')


if request.method == 'POST':
url = 'https://toefl-registration.ets.org/TOEFLWeb/logon.do'
data = {
'password': request.POST.get('password', ''),
'username': request.POST.get('username', ''),
'org.apache.struts.taglib.html.TOKEN': 
request.POST.get('org.apache.struts.taglib.html.TOKEN', '')
   }

page = session.post(url, data=data)


return HttpResponse(request,page.text)

My post request is not same as post request made by toefl original web site 
and instead of login shows error as : We are sorry, our servers are 
currently busy. Please wait a few minutes and retry your request.

what is the problem? someone in other corporation did this without error

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


Re: Recipe to upgrade to Python 3.x on Ubuntu 12.04 and 14.04

2016-09-08 Thread Erik Cederstrand

> Den 7. sep. 2016 kl. 10.49 skrev James Schneider :
> 
> You may also want to consider building in a configuration manager such as 
> Ansible or Salt stack. Once set up, you can deploy multiple staging and prod 
> servers with a couple commands. With the right planning, that could 
> potentially work across major Ubuntu versions as an upgrade path. 
> 
> Probably won't save you time up front, but it definitely will next time this 
> comes around, with the added bonus of a near instantaneous recovery of a 
> dev/prod system build with little need for backups beyond your custom app 
> code and the play books for your config management.

I'll chime in and say that this is really a must nowadays if you're hosting 
your own services. Not having a server configuration that you can deploy to a 
new server within minutes is like building a Django project and not having a 
requirements.txt. Sure, you can pip install everything manually and memorize 
which packages you're using and which versions are compatible with your 
project, but a list of requirements is just so much better.

Erik

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


[X-Post][Inpycon] Regarding Invitation Dev Sprint Pycon India

2016-09-08 Thread Jaysinh shukla
Respected Members,
Dev Sprint is the best way to collaborate/guide other contributors 
physically rather than over IRC / email. We invite this community to join 
and hack for whole 3 days during the conference. Programmers are dreaming 
of contributing but they are unable to just because of lacking guidance.
It will be a proud moment to mentor participants for whole three days 
and encourage them to be the active contributor for the project. Large 
contributing guidelines are always hard to digest.
CFP is already started. We invite you to submit a proposal 
[here](https://in.pycon.org/cfp/dev-sprint-2016/proposals/).

Schedule for Dev sprint [Pycon India, New Delhi](https://in.pycon.org)

 * Day-I: 23rd September 2016 - Full day
 * Day-II: 24th September 2016 - 5.00 PM to 9.00 PM
 * Day-III: 25th September 2016 - 5.00 PM to 9.00 PM

Note: If you are reading this mail and you believe referring interested 
contributors will help to represent project well, feel free to drop me a 
mail. I will try to invite them individually. Many Thanks! 

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


Re: Django group email in spam

2016-09-08 Thread Uri Even-Chen
Same here, and the problem is I filtered the group messages to skip my
inbox in Gmail, and I can't filter them never to send them to spam, because
then they will not skip my inbox (it's a bug in Gmail). So I have to enter
my spam folder manually and mark each message as "not spam". By the way,
also messages to Django developers mailing list are marked as spam.


*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
  
    

On Wed, Sep 7, 2016 at 11:05 PM, sylvain_grodes 
wrote:

> Same problem here, I have to check my spam and unset the spam flag.
>
>
>
> Le vendredi 2 septembre 2016 02:12:18 UTC-4, Lachlan Musicman a écrit :
>>
>> Hey,
>>
>> I've been seeing a lot of Django group email going into my spam folder
>> over the last 48 hours.
>>
>> Have there been any changes to the group that may have caused this?
>>
>> cheers
>> L.
>> --
>> The most dangerous phrase in the language is, "We've always done it this
>> way."
>>
>> - Grace Hopper
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/de7b0239-ff49-4c83-acb8-53308a1178e2%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Group results with multiple uses of annotate()

2016-09-08 Thread Adam Starrh


I've got the following function in a manager which seems to work well, 
annotating data and grouping results by "variety name":




def by_variety_and_date(self, start_date, end_date):
return self.model.objects.filter(
date__range=(start_date, end_date)
).values(
"variety__name"
).annotate(
total_kgs=Sum('qty_applied'),
total_profit=Sum('profit'),
grand_total_cogs=Sum('total_cogs'),
total_sales=Sum('value'),
).order_by('-total_kgs')



However, I would like to add a piece of information like so:



def by_variety_and_date(self, start_date, end_date):
return self.model.objects.filter(
date__range=(start_date, end_date)
).values(
"variety__name"
).annotate(
total_kgs=Sum('qty_applied'),
total_profit=Sum('profit'),
grand_total_cogs=Sum('total_cogs'),
total_sales=Sum('value'),
).annotate(
final_margin=Case(
When(total_sales=0, then=0),
default=(Sum(F('profit')) / Sum(F('value')))*100
)
).order_by('-total_kgs')


In this case, the grouping doesn't work, and each item is returned separately. 
Essentially `.values().annotate()` works, but `.values().annotate().annotate()` 
seems to break. 


I've also tried `.annotate().annotate().values()` as well to no avail.


Is this the intended behavior? Am I missing a piece of instruction? 


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


Re: Group results with multiple uses of annotate()

2016-09-08 Thread Adam Starrh
OK I got this to work. The second annotate needs to go at the end, so that 
the order is as follows: .filter().values().annotate().order_by().annotate()

On Thursday, September 8, 2016 at 10:04:40 AM UTC-4, Adam Starrh wrote:
>
> I've got the following function in a manager which seems to work well, 
> annotating data and grouping results by "variety name":
>
>
>
>
> def by_variety_and_date(self, start_date, end_date):
> return self.model.objects.filter(
> date__range=(start_date, end_date)
> ).values(
> "variety__name"
> ).annotate(
> total_kgs=Sum('qty_applied'),
> total_profit=Sum('profit'),
> grand_total_cogs=Sum('total_cogs'),
> total_sales=Sum('value'),
> ).order_by('-total_kgs')
>
>
>
> However, I would like to add a piece of information like so:
>
>
>
> def by_variety_and_date(self, start_date, end_date):
> return self.model.objects.filter(
> date__range=(start_date, end_date)
> ).values(
> "variety__name"
> ).annotate(
> total_kgs=Sum('qty_applied'),
> total_profit=Sum('profit'),
> grand_total_cogs=Sum('total_cogs'),
> total_sales=Sum('value'),
> ).annotate(
> final_margin=Case(
> When(total_sales=0, then=0),
> default=(Sum(F('profit')) / Sum(F('value')))*100
> )
> ).order_by('-total_kgs')
>
>
> In this case, the grouping doesn't work, and each item is returned 
> separately. Essentially `.values().annotate()` works, but 
> `.values().annotate().annotate()` seems to break. 
>
>
> I've also tried `.annotate().annotate().values()` as well to no avail.
>
>
> Is this the intended behavior? Am I missing a piece of instruction? 
>
>
>

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


Custom form fields in admin site

2016-09-08 Thread Luis Zárate
Hi,  I am trying to do something like


class MyForm(forms.ModelForm):
 myextra_field = forms.IntegerField()

class Meta:
  models = Mymodel
  fields = '__all__'

class MymodelAdmin(admin.ModelAdmin):
  form = MyForm
  fields = ["name", 'myextra_field']

def save(self, *args, **kwargs)
do something with myextra_field


I know that is possible to specify readonly_fields and fields works but in
readonly mode that is not what i want.

So is there any way to have extra form fields in admin.ModelAdmin in edit
mode?



-- 
"La utopía sirve para caminar" Fernando Birri

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


Re: Python post to remote host

2016-09-08 Thread Luis Zárate
see http://docs.python-requests.org/en/master/

2016-09-08 5:57 GMT-06:00 alireza Rahmani khalili <
sanfrancisco.alir...@gmail.com>:

>
>
> down votefavorite
> 
>
> Hi I want to write robot to register in toefl test , I send request to
> remote web site as:
>
> from django.http import HttpResponse
> import requests
> from bs4 import BeautifulSoupfrom django.middleware import csrf
>
> def index(request):
> session = requests.Session()
> page = 
> session.get('https://toefl-registration.ets.org/TOEFLWeb/extISERLogonPrompt.do')
>
>
> if request.method == 'POST':
> url = 'https://toefl-registration.ets.org/TOEFLWeb/logon.do'
> data = {
> 'password': request.POST.get('password', ''),
> 'username': request.POST.get('username', ''),
> 'org.apache.struts.taglib.html.TOKEN': 
> request.POST.get('org.apache.struts.taglib.html.TOKEN', '')
>}
>
> page = session.post(url, data=data)
>
>
> return HttpResponse(request,page.text)
>
> My post request is not same as post request made by toefl original web
> site and instead of login shows error as : We are sorry, our servers are
> currently busy. Please wait a few minutes and retry your request.
>
> what is the problem? someone in other corporation did this without error
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/75c2e724-5616-41d6-9c0d-cdef3887d3e1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

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


Re: Django group email in spam

2016-09-08 Thread Luis Zárate
I have the same behavior

2016-09-08 7:06 GMT-06:00 Uri Even-Chen :

> Same here, and the problem is I filtered the group messages to skip my
> inbox in Gmail, and I can't filter them never to send them to spam, because
> then they will not skip my inbox (it's a bug in Gmail). So I have to enter
> my spam folder manually and mark each message as "not spam". By the way,
> also messages to Django developers mailing list are marked as spam.
>
>
> *Uri Even-Chen*
> [image: photo] Phone: +972-54-3995700
> Email: u...@speedy.net
> Website: http://www.speedysoftware.com/uri/en/
> 
> 
>   
>
> On Wed, Sep 7, 2016 at 11:05 PM, sylvain_grodes 
> wrote:
>
>> Same problem here, I have to check my spam and unset the spam flag.
>>
>>
>>
>> Le vendredi 2 septembre 2016 02:12:18 UTC-4, Lachlan Musicman a écrit :
>>>
>>> Hey,
>>>
>>> I've been seeing a lot of Django group email going into my spam folder
>>> over the last 48 hours.
>>>
>>> Have there been any changes to the group that may have caused this?
>>>
>>> cheers
>>> L.
>>> --
>>> The most dangerous phrase in the language is, "We've always done it this
>>> way."
>>>
>>> - Grace Hopper
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/de7b0239-ff49-4c83-acb8-53308a1178e2%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAMQ2MsHCqeD8wgg_EEwfj69bwCHBSu8BSDpY09waVbs3zM
> WRGg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

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


Re: Recipe to upgrade to Python 3.x on Ubuntu 12.04 and 14.04

2016-09-08 Thread Mike Dewhirst

On 8/09/2016 10:12 PM, Erik Cederstrand wrote:

Den 7. sep. 2016 kl. 10.49 skrev James Schneider :

You may also want to consider building in a configuration manager such as 
Ansible or Salt stack. Once set up, you can deploy multiple staging and prod 
servers with a couple commands. With the right planning, that could potentially 
work across major Ubuntu versions as an upgrade path.

Probably won't save you time up front, but it definitely will next time this 
comes around, with the added bonus of a near instantaneous recovery of a 
dev/prod system build with little need for backups beyond your custom app code 
and the play books for your config management.

I'll chime in and say that this is really a must nowadays if you're hosting 
your own services. Not having a server configuration that you can deploy to a 
new server within minutes is like building a Django project and not having a 
requirements.txt. Sure, you can pip install everything manually and memorize 
which packages you're using and which versions are compatible with your 
project, but a list of requirements is just so much better.


I agree. My practise is to never directly apt-get install and never pip 
install either. I have a single bash script called install.host and 
that's where I put all such OS edits. I run the script to make the 
install and then comment out that line afterwards. It also does the 
security upgrades from the Ubuntu repos. I then take that script to a 
new (next) machine, uncomment as appropriate and let it rip.


That has worked for me so far but now I want to use Python 3.5 and 
probably virtualenv (which I have previously only used on dev machines) 
and Apache2.4 (previously Apache 2.2) and mod_wsgi etc etc.


Bottom line is I think I have to invest a bit of effort in a new Ubuntu 
16.04 machine. But I would prefer a lovely easy recipe to bring Python 
3.5 to both my existing servers being 12.04 staging and 14.04 production.


Thanks Erik

Mike




Erik



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50bc76f6-6886-29d1-48aa-46f3e80249f1%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


pymssql

2016-09-08 Thread sum abiut
Hi,
i have used pymssql to connet to windows database but i want to be able
iterate and  only print out some specific fields.

here is what i did

conn=pymssql.connect(server,username,password,database)
cus=conn.cursor()
cus.execute("SELECT * FROM glbud ")

for row in cus:
   print(row)
this works perfect, but when i try to iterate through and only print out
specific fields i got the error NameError: name 'budget_code' is not defined


for row in cus:
   print(row.budget_code)


NameError: name 'budget_code' is not defined

the column name is budget_code, in mssql server 2008


any idea what i am doing wrong? please advise

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