Re: manage.py and django-admin.py help

2013-03-01 Thread Russell Keith-Magee
On Thu, Feb 28, 2013 at 8:48 AM, Clientkill  wrote:

> this is the most confusing process I've ever done. I wish the django IRC
> channel was open
>
> Django's IRC channel *is* open.

However, you have to use a registered nickname -- you can't just join the
channel. Registering your nickname costs nothing, but ensures that nobody
in the #django channel (or any other channel for that matter) can pretend
to be someone they aren't.

http://freenode.net/faq.shtml#userregistration

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how to tricking LogEntry model ?

2013-03-01 Thread Bino Oetomo
Dear All ..

I Try to write a custom auth backend.
It'll use external user model/table, let's call it 'myuser'

With this scenario, the LogEntry will receive a user_id that not exist
in default User model.
So it will generate exception.

I read that we can do a 'pre_save' signal receiver for LogEntry
http://stackoverflow.com/questions/4176238/django-extending-logentry

Now, I have this ini myproject/management/__init__.py

--START-
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.contrib.admin.models import LogEntry

print 'THIS IS LOGENTRY PRE-SAVE'

@receiver(pre_save, sender=LogEntry)
def mypresave(change, **kwargs):
print 'PRE SAVE, CHANGE ', kwargs
--STOP--

and when I 'runserver', looks like it is loaded
START---
^Cbino@bino-pata:~/Documents/django/mas/mas01$ python ./manage.py
runserver
THIS IS LOGENTRY PRE-SAVE
THIS IS LOGENTRY PRE-SAVE
Validating models...
0 errors found
Django version 1.4.3, using settings 'mas01.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
STOP

But when I try to do some change on my data, the debug console didn't
print any thing form 'mypresave'

Kindly please tell me how to do it properly.
and also ...how to tell LogEntry to do nothing for any signal from
some specific models ?
Since I plan to make a model that have one-to-one relation to
LogEntry, and want logentry do nothing when something write to this
model.

Sincerely
-bino-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Converting Django app into a Desktop app

2013-03-01 Thread Kevin London
@Loai, how did Pyinstaller work out for you? Is that the route you took?

On Thursday, December 20, 2012 10:20:31 PM UTC-8, Loai Ghoraba wrote:
>
> @Filib: thanks a lot, seems that is what I will need exactly :)
>
> On Fri, Dec 21, 2012 at 1:37 AM, Mike Dewhirst 
> 
> > wrote:
>
>> See also 
>> https://us.pycon.org/2012/**schedule/presentation/393/by
>>  Ryan Kelly and his 'esky' package for safely updating distributed apps. 
>> There is a link to that and other items in the above pycon talk.
>>
>> Mike
>>
>>
>>
>> On 21/12/2012 9:55am, Filip Wasilewski wrote:
>>
>>> Hi,
>>>
>>> On Tuesday, December 18, 2012 5:06:19 PM UTC+1, Loai Ghoraba wrote:
>>>
>>> Hi
>>>
>>> I am very comfortable with Django, and I was wondering about whether
>>> there is some way to convert a Django web app into a Desktop app
>>> (may be not 100%), so that I can distribute it to users. May be
>>> wrapping it in a light web server "if there is something like this".
>>>
>>>
>>> I've been recently going through the process of distributing Django web
>>> application with binary dependencies (NumPy/SciPy) as an one-click
>>> executable. I have evaluated several solutions and the most effective
>>> was creating a single-file binary package using PyInstaller
>>> (pyinstaller.org, development version with some modifications for proper
>>> dependency discovery). As for the web server I went with the pure-Python
>>> CherryPy server (cherrypy.org). See 
>>> https://gist.github.com/**4349257for
>>> sample server script.
>>>
>>>
>>> Filip
>>> en.ig.ma
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/**msg/django-users/-/**7umVeAxLLBAJ
>>> .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to
>>> django-users...@**googlegroups.com .
>>> For more options, visit this group at
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to django-users...@**
>> googlegroups.com .
>> For more options, visit this group at http://groups.google.com/**
>> group/django-users?hl=en
>> .
>>
>>
>
-- 
This e-mail is the property of LightIron Digital LLC. It is intended only 
for the person or entity to which it is addressed and may contain 
information that is privileged, confidential, or otherwise protected from 
disclosure. Distribution or copying of this e-mail, or the information 
contained herein, to anyone other than the intended recipient is prohibited.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




os.system() is not working in django while working on server centos

2013-03-01 Thread JAI PRAKASH SINGH
import sys,os
sys.stderr = open('/dev/null')
import paramiko
sys.stderr = sys.__stderr__

os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2
def ssh2_connect(host, user, pswd, port=22):
try:
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, user, pswd)
return ssh

except Exception, e:
return str(e) + "Error. Failed to connect. Wrong 
IP/Username/Password"


def ssh2_exec(ssh, cmd, sudo=False):
result = []
try:
channel = ssh.get_transport().open_session()
if sudo:
channel.get_pty()
except:
  return result

stdin = channel.makefile('wb')
stdout = channel.makefile('rb')

channel.exec_command(cmd)

exit_status = channel.recv_exit_status()

if exit_status == 0:
for line in stdout:
result.append(line)
channel.close()
return result


def ssh2_close(ssh):
ssh.close()
return


def ssh2_copyToFile(ssh, local_file, remote_file):
sftp = paramiko.SFTPClient.from_transport(ssh.get_transport())
sftp.put(local_file, remote_file)
return

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Ordering a QuerySet based on a latest child models field

2013-03-01 Thread Sven Grunewaldt


Lets assume I want to show a list of runners ordered by their latest sprint 
time.

class Runner(models.Model):
name = models.CharField(max_length=255)

class Sprint(models.Model):
runner = models.ForeignKey(Runner)
time = models.PositiveIntegerField()
created = models.DateTimeField(auto_now_add=True)


This is a quick sketch of what I would do in SQL:

SELECT runner.id, runner.name, sprint.time
FROM runner
LEFT JOIN sprint ON (sprint.runner_id = runner.id)
WHERE 
  sprint.id = (
SELECT sprint_inner.id
FROM sprint as sprint_inner
WHERE sprint_inner.runner_id = runner.id
ORDER BY sprint_inner.created DESC
LIMIT 1
  )
  OR sprint.id = NULL
ORDER BY sprint.time ASC


The Django QuerySet documentation states:

> It is permissible to specify a multi-valued field to order the results by 
> (for example, a ManyToManyField field). Normally this won’t be a sensible 
> thing to do and it’s really an advanced usage feature. However, if you know 
> that your queryset’s filtering or available data implies that there will 
> only be one ordering piece of data for each of the main items you are 
> selecting, the ordering may well be exactly what you want to do. Use 
> ordering on multi-valued fields with care and make sure the results are 
> what you expect.

 

I guess I need to apply some filter here, but I'm not sure what exactly 
Django expects...

One note because it is not obvious in this example: the Runner table will 
have several hundred entries, the sprints will also have several hundreds 
and in some later days probably several thousand entries. The data will be 
displayed in a paginated view, so sorting in Python is not an option.

The only other possibility I see is writing the SQL myself, but I'd like to 
avoid this at all cost.

PS: This is a copy of my StackOverflow 
question: http://stackoverflow.com/q/15154863/360593

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Test database not auto-flushing

2013-03-01 Thread Matt
 

I have a bunch of unit test files, all of which consist of 
django.test.TestCase classes.

Wrote myself a little shell script to uncomment/comment test file imports 
in my __init__.py file, so I can run tests from certain test files, based 
off the command line arguments I give it. I am also able to run all the 
tests of all the test files in one go (for regression testing purposes).

I have this one test file that has some JSON fixtures and the first test 
checks that a certain model/table has 3 records in it (defined by the JSON 
fixture).

So here is the problem: when I run this test file on its own its tests pass 
with flying colours, but when I run the test with all other tests, that 
particular test case I mentioned, fails.

When I run all the tests, the database says there are 6 records in the 
table/model, but there should only be 3 (from the fixture), like when the 
test file is run by itself.

I also tried running the that test file with a few other test files (not 
all) and it passes. So the only time it doesn't, is when all the test files 
are run.

To me this seems like a bug in Django or PostgreSQL (DB I am using), 
because aren't Django TestCases supposed to auto-flush/reset the database 
between each test method, let alone test class?

Posted on stackoverflow (
http://stackoverflow.com/questions/15124828/django-test-database-not-auto-flushing),
 
but haven't got a response yet.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how to create formset field but not used loop in template

2013-03-01 Thread Witold Greń
When i create formset in template i must used loop "for":

{{ formset_create_company.management_form }}

{% for form in formset_create_company.forms %}







{{ form.postal_code.label }}

{{ form.postal_code }}





{{ form.city.label }}

{{ form.city }}





   

{{ form.street.label }}

{{ form.street }}







{{ form.no_house.label }}

{{ form.no_house }}





{{ form.no_local.label }}

{{ form.no_local }}







{% endfor %}


OR


{{ formset_create_company.management_form }}

{% for field in formset_create_company %}



{{ field.errors }}

{{ field.label_tag }}: {{ field }}



{% endfor %}


How to create field but not used loop "for"? eg. {{ formset_create_company.
form.no_house }}??

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Problem UserAdmin with GenericStackedInline in Django 1.5c2

2013-03-01 Thread Witold Greń
Hm.. I am not extending User Model.

I lost one class, this is real example:

Create APPs: core

SETTINGS:

#Django 1.5

AUTH_USER_MODEL = 'core.Partners'



MODELS:

# -*- coding: utf-8 -*-

from django.db import models

from django.contrib.contenttypes.models import ContentType

from django.contrib.contenttypes import generic

from django.utils.translation import ugettext_lazy as _

from django.contrib.auth.models import BaseUserManager, AbstractBaseUser, 
PermissionsMixin

from django.conf import settings


class CreateModified(models.Model):

date_create = models.DateTimeField(auto_now_add=True)

date_modified = models.DateTimeField(auto_now=True)

user_create_fk = models.ForeignKey(settings.AUTH_USER_MODEL, 
related_name='%(app_label)s_%(class)s_usercreate', blank=True,null=True)

user_modified_fk = models.ForeignKey(settings.AUTH_USER_MODEL, 
related_name='%(app_label)s_%(class)s_userchange', blank=True,null=True)

class Meta:

abstract = True

class Addresses(CreateModified):

"""

Fields extends from CreateModified

date_create = models.DateTimeField(auto_now_add=True)

date_modified = models.DateTimeField(auto_now=True)

THIS IS PROBLEM:

user_create_fk = models.ForeignKey(settings.AUTH_USER_MODEL, 
related_name='%(app_label)s_%(class)s_usercreate', blank=True,null=True)

user_modified_fk = models.ForeignKey(settings.AUTH_USER_MODEL, 
related_name='%(app_label)s_%(class)s_userchange', blank=True,null=True)

"""

name = models.CharField(max_length=200, verbose_name='Nazwa')

street = models.CharField(max_length=200, verbose_name='Ulica')

no_house = models.IntegerField(verbose_name='Numer budynku')

no_local = models.IntegerField(verbose_name='Numer lokalu', blank=True, 
null=True)

postal_code = models.CharField(max_length=200, verbose_name='Kod 
pocztowy')

city = models.CharField(max_length=200, verbose_name='Miasto')

region = models.CharField(max_length=200, verbose_name='Województwo')

content_type = models.ForeignKey(ContentType,verbose_name='Rodzaj 
modelu', related_name="content_type_%(class)s",)

object_id = models.PositiveIntegerField(verbose_name='Rodzaj obiekt', 
db_index=True)

content_object = generic.GenericForeignKey('content_type', 'object_id')



class Partners(CreateModified, AbstractBaseUser, PermissionsMixin):

login = models.CharField(max_length=200, verbose_name='Login', 
help_text=_('Required. 30 characters or fewer. Letters, numbers and 
@/./+/-/_ characters'), unique=True, db_index=True)

company = models.BooleanField(verbose_name='Firma/Prywatny')

company_name = models.CharField(max_length=200, verbose_name='Nazwa 
firmy', blank=True, null=True)

www = models.URLField(verbose_name='Strona internetowa', blank=True, 
null=True)

name = models.CharField(max_length=200, verbose_name='Imię', blank=True, 
null=True)

surname = models.CharField(max_length=200, verbose_name='Nazwisko', 
blank=True, null=True)

phone = models.CharField(max_length=200, verbose_name='Telefon', blank=
True, null=True)

email = models.EmailField(verbose_name='Email', blank=True, null=True)

regulations = models.BooleanField(verbose_name='Regulamin', default=True
)

date_of_birth = models.DateField(verbose_name='Data urodzenia', blank=
True, null=True)

is_staff = models.BooleanField(_('staff status'), default=True, 
help_text=_('Designates whether the user can log into this admin site.'))

is_active = models.BooleanField(_('active'), default=True, 
help_text=_('Designates 
whether this user should be treated as active. Unselect this instead of 
deleting accounts.'))

date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)

objects = PartnersManager()


USERNAME_FIELD = 'login'

REQUIRED_FIELDS = []


def get_full_name(self):

return '%s %s' % (self.name, self.surname)


def get_short_name(self):

return self.login


def __unicode__(self):

return self.login


class Meta:

verbose_name = "Użytkownik"

verbose_name_plural = "Użytkownicy"

ordering = ['id']

get_latest_by = "id"



FORMS:

# -*- coding: utf-8 -*-

from django import forms

from django.contrib.auth.forms import ReadOnlyPasswordHashField

from core.models import Partners, Addresses

from django.forms import widgets

from django.utils.translation import ugettext_lazy as _


class PartnersCreationForm(forms.ModelForm):

"""A form for creating new users. Includes all the required fields, 
plus a repeated password."""

password1 = forms.CharField(label='Password', 
widget=forms.PasswordInput)

password2 = forms.CharField(label='Password confirmation', 
widget=forms.PasswordInput)


class Meta:

model = Partners

fields = ('login',)


def clean_password2(self):

# Check that the two password entries match

password1 = self.cleaned_data.get("pas

Re: how to create formset field but not used loop in template

2013-03-01 Thread Daniel Roseman


On Friday, 1 March 2013 11:43:22 UTC, Witold Greń wrote:
>
> When i create formset in template i must used loop "for":
>
> 
>
> How to create field but not used loop "for"? eg. {{ 
> formset_create_company.form.no_house }}??
>

Can you explain why you don't want to use for? Seems perfectly sensible to 
me, a formset contains multiple forms so you need to use a loop.
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: os.system() is not working in django while working on server centos

2013-03-01 Thread Tom Evans
On Fri, Mar 1, 2013 at 11:29 AM, JAI PRAKASH SINGH
 wrote:
> import sys,os
> sys.stderr = open('/dev/null')
> import paramiko
> sys.stderr = sys.__stderr__
>
> os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2
> def ssh2_connect(host, user, pswd, port=22):
> try:
> ssh = paramiko.SSHClient()
> ssh.load_system_host_keys()
> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
> ssh.connect(host, port, user, pswd)
> return ssh
>
> except Exception, e:
> return str(e) + "Error. Failed to connect. Wrong
> IP/Username/Password"
>
>
> def ssh2_exec(ssh, cmd, sudo=False):
> result = []
> try:
> channel = ssh.get_transport().open_session()
> if sudo:
> channel.get_pty()
> except:
>   return result
>
> stdin = channel.makefile('wb')
> stdout = channel.makefile('rb')
>
> channel.exec_command(cmd)
>
> exit_status = channel.recv_exit_status()
>
> if exit_status == 0:
> for line in stdout:
> result.append(line)
> channel.close()
> return result
>
>
> def ssh2_close(ssh):
> ssh.close()
> return
>
>
> def ssh2_copyToFile(ssh, local_file, remote_file):
> sftp = paramiko.SFTPClient.from_transport(ssh.get_transport())
> sftp.put(local_file, remote_file)
> return
>

This doesn't seem related to Django… try a python mailing list.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: password encryption

2013-03-01 Thread Tomas Neme
> We haven't used SHA-based or MD5-based hashing for some time.

oh, I was convinced sha2 was being used.

I probably just read the code a while ago and didn't notice it in the changelogs


--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: os.system() is not working in django while working on server centos

2013-03-01 Thread JAI PRAKASH SINGH
No Tom it just a part of code from django views

i just want to know .. is any another systemcall i should use to log a file 
???

or if u have batter option to log a file please share ... i will thankfull 
to u ..

till thenn i m posting it to python post also..

On Friday, March 1, 2013 6:33:05 PM UTC+5:30, Tom Evans wrote:
>
> On Fri, Mar 1, 2013 at 11:29 AM, JAI PRAKASH SINGH 
> > wrote: 
> > import sys,os 
> > sys.stderr = open('/dev/null') 
> > import paramiko 
> > sys.stderr = sys.__stderr__ 
> > 
> > os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2 
> > def ssh2_connect(host, user, pswd, port=22): 
> > try: 
> > ssh = paramiko.SSHClient() 
> > ssh.load_system_host_keys() 
> > ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 
> > ssh.connect(host, port, user, pswd) 
> > return ssh 
> > 
> > except Exception, e: 
> > return str(e) + "Error. Failed to connect. Wrong 
> > IP/Username/Password" 
> > 
> > 
> > def ssh2_exec(ssh, cmd, sudo=False): 
> > result = [] 
> > try: 
> > channel = ssh.get_transport().open_session() 
> > if sudo: 
> > channel.get_pty() 
> > except: 
> >   return result 
> > 
> > stdin = channel.makefile('wb') 
> > stdout = channel.makefile('rb') 
> > 
> > channel.exec_command(cmd) 
> > 
> > exit_status = channel.recv_exit_status() 
> > 
> > if exit_status == 0: 
> > for line in stdout: 
> > result.append(line) 
> > channel.close() 
> > return result 
> > 
> > 
> > def ssh2_close(ssh): 
> > ssh.close() 
> > return 
> > 
> > 
> > def ssh2_copyToFile(ssh, local_file, remote_file): 
> > sftp = paramiko.SFTPClient.from_transport(ssh.get_transport()) 
> > sftp.put(local_file, remote_file) 
> > return 
> > 
>
> This doesn't seem related to Django… try a python mailing list. 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: os.system() is not working in django while working on server centos

2013-03-01 Thread JAI PRAKASH SINGH
No Tom it just a part of code from django views

i just want to know .. is any another systemcall i should use to log a file
???

or if u have batter option to log a file please share ... i will thankfull
to u ..

till thenn i m posting it to python post also..

On Fri, Mar 1, 2013 at 7:38 PM, JAI PRAKASH SINGH <
jaiprakashsingh...@gmail.com> wrote:

> No Tom it just a part of code from django views
>
> i just want to know .. is any another systemcall i should use to log a
> file ???
>
> or if u have batter option to log a file please share ... i will thankfull
> to u ..
>
> till thenn i m posting it to python post also..
>
> On Friday, March 1, 2013 6:33:05 PM UTC+5:30, Tom Evans wrote:
>>
>> On Fri, Mar 1, 2013 at 11:29 AM, JAI PRAKASH SINGH
>>  wrote:
>> > import sys,os
>> > sys.stderr = open('/dev/null')
>> > import paramiko
>> > sys.stderr = sys.__stderr__
>> >
>> > os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2
>> > def ssh2_connect(host, user, pswd, port=22):
>> > try:
>> > ssh = paramiko.SSHClient()
>> > ssh.load_system_host_keys()
>> > ssh.set_missing_host_key_**policy(paramiko.AutoAddPolicy(**))
>> > ssh.connect(host, port, user, pswd)
>> > return ssh
>> >
>> > except Exception, e:
>> > return str(e) + "Error. Failed to connect. Wrong
>> > IP/Username/Password"
>> >
>> >
>> > def ssh2_exec(ssh, cmd, sudo=False):
>> > result = []
>> > try:
>> > channel = ssh.get_transport().open_**session()
>> > if sudo:
>> > channel.get_pty()
>> > except:
>> >   return result
>> >
>> > stdin = channel.makefile('wb')
>> > stdout = channel.makefile('rb')
>> >
>> > channel.exec_command(cmd)
>> >
>> > exit_status = channel.recv_exit_status()
>> >
>> > if exit_status == 0:
>> > for line in stdout:
>> > result.append(line)
>> > channel.close()
>> > return result
>> >
>> >
>> > def ssh2_close(ssh):
>> > ssh.close()
>> > return
>> >
>> >
>> > def ssh2_copyToFile(ssh, local_file, remote_file):
>> > sftp = paramiko.SFTPClient.from_**transport(ssh.get_transport())
>> > sftp.put(local_file, remote_file)
>> > return
>> >
>>
>> This doesn't seem related to Django… try a python mailing list.
>>
>> Cheers
>>
>> Tom
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: os.system() is not working in django while working on server centos

2013-03-01 Thread Sergiy Khohlov
take a look
https://docs.djangoproject.com/en/dev/topics/logging/

 using paramiko inside views ... I would like to say  that you know a
meaning of the sex :-)

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Fri, Mar 1, 2013 at 4:26 PM, JAI PRAKASH SINGH <
jaiprakashsingh...@gmail.com> wrote:

> No Tom it just a part of code from django views
>
> i just want to know .. is any another systemcall i should use to log a
> file ???
>
> or if u have batter option to log a file please share ... i will thankfull
> to u ..
>
> till thenn i m posting it to python post also..
>
> On Fri, Mar 1, 2013 at 7:38 PM, JAI PRAKASH SINGH <
> jaiprakashsingh...@gmail.com> wrote:
>
>> No Tom it just a part of code from django views
>>
>> i just want to know .. is any another systemcall i should use to log a
>> file ???
>>
>> or if u have batter option to log a file please share ... i will
>> thankfull to u ..
>>
>> till thenn i m posting it to python post also..
>>
>> On Friday, March 1, 2013 6:33:05 PM UTC+5:30, Tom Evans wrote:
>>>
>>> On Fri, Mar 1, 2013 at 11:29 AM, JAI PRAKASH SINGH
>>>  wrote:
>>> > import sys,os
>>> > sys.stderr = open('/dev/null')
>>> > import paramiko
>>> > sys.stderr = sys.__stderr__
>>> >
>>> > os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2
>>> > def ssh2_connect(host, user, pswd, port=22):
>>> > try:
>>> > ssh = paramiko.SSHClient()
>>> > ssh.load_system_host_keys()
>>> > ssh.set_missing_host_key_**policy(paramiko.AutoAddPolicy(**))
>>> > ssh.connect(host, port, user, pswd)
>>> > return ssh
>>> >
>>> > except Exception, e:
>>> > return str(e) + "Error. Failed to connect. Wrong
>>> > IP/Username/Password"
>>> >
>>> >
>>> > def ssh2_exec(ssh, cmd, sudo=False):
>>> > result = []
>>> > try:
>>> > channel = ssh.get_transport().open_**session()
>>> > if sudo:
>>> > channel.get_pty()
>>> > except:
>>> >   return result
>>> >
>>> > stdin = channel.makefile('wb')
>>> > stdout = channel.makefile('rb')
>>> >
>>> > channel.exec_command(cmd)
>>> >
>>> > exit_status = channel.recv_exit_status()
>>> >
>>> > if exit_status == 0:
>>> > for line in stdout:
>>> > result.append(line)
>>> > channel.close()
>>> > return result
>>> >
>>> >
>>> > def ssh2_close(ssh):
>>> > ssh.close()
>>> > return
>>> >
>>> >
>>> > def ssh2_copyToFile(ssh, local_file, remote_file):
>>> > sftp = paramiko.SFTPClient.from_**transport(ssh.get_transport())
>>> > sftp.put(local_file, remote_file)
>>> > return
>>> >
>>>
>>> This doesn't seem related to Django… try a python mailing list.
>>>
>>> Cheers
>>>
>>> Tom
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: os.system() is not working in django while working on server centos

2013-03-01 Thread JAI PRAKASH SINGH
he he :)


On Fri, Mar 1, 2013 at 7:59 PM, Sergiy Khohlov  wrote:

> take a look
> https://docs.djangoproject.com/en/dev/topics/logging/
>
>  using paramiko inside views ... I would like to say  that you know a
> meaning of the sex :-)
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Fri, Mar 1, 2013 at 4:26 PM, JAI PRAKASH SINGH <
> jaiprakashsingh...@gmail.com> wrote:
>
>> No Tom it just a part of code from django views
>>
>> i just want to know .. is any another systemcall i should use to log a
>> file ???
>>
>> or if u have batter option to log a file please share ... i will
>> thankfull to u ..
>>
>> till thenn i m posting it to python post also..
>>
>> On Fri, Mar 1, 2013 at 7:38 PM, JAI PRAKASH SINGH <
>> jaiprakashsingh...@gmail.com> wrote:
>>
>>> No Tom it just a part of code from django views
>>>
>>> i just want to know .. is any another systemcall i should use to log a
>>> file ???
>>>
>>> or if u have batter option to log a file please share ... i will
>>> thankfull to u ..
>>>
>>> till thenn i m posting it to python post also..
>>>
>>> On Friday, March 1, 2013 6:33:05 PM UTC+5:30, Tom Evans wrote:

 On Fri, Mar 1, 2013 at 11:29 AM, JAI PRAKASH SINGH
  wrote:
 > import sys,os
 > sys.stderr = open('/dev/null')
 > import paramiko
 > sys.stderr = sys.__stderr__
 >
 > os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2
 > def ssh2_connect(host, user, pswd, port=22):
 > try:
 > ssh = paramiko.SSHClient()
 > ssh.load_system_host_keys()
 > ssh.set_missing_host_key_**policy(paramiko.AutoAddPolicy(**))

 > ssh.connect(host, port, user, pswd)
 > return ssh
 >
 > except Exception, e:
 > return str(e) + "Error. Failed to connect. Wrong
 > IP/Username/Password"
 >
 >
 > def ssh2_exec(ssh, cmd, sudo=False):
 > result = []
 > try:
 > channel = ssh.get_transport().open_**session()
 > if sudo:
 > channel.get_pty()
 > except:
 >   return result
 >
 > stdin = channel.makefile('wb')
 > stdout = channel.makefile('rb')
 >
 > channel.exec_command(cmd)
 >
 > exit_status = channel.recv_exit_status()
 >
 > if exit_status == 0:
 > for line in stdout:
 > result.append(line)
 > channel.close()
 > return result
 >
 >
 > def ssh2_close(ssh):
 > ssh.close()
 > return
 >
 >
 > def ssh2_copyToFile(ssh, local_file, remote_file):
 > sftp = paramiko.SFTPClient.from_**transport(ssh.get_transport())
 > sftp.put(local_file, remote_file)
 > return
 >

 This doesn't seem related to Django… try a python mailing list.

 Cheers

 Tom

>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/1f-Xb0e0NN0/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
>
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django save method in infinite loop, code review?

2013-03-01 Thread sparky
Django newbie :) I'm wondering if you *kind people* could help me work out 
how to solve a little issue I'm having :) I'm using *S3 storage* via the 
package django-storages .

The following code gets stuck in an endless loop. I know  just enough to 
know why, but not how to solve...

*Remembering I'm a newbie*


This is what the the code I have written does so far

1) profile gets saves and image uploaded *(without the resize of course)*to S3 
- 
*PERFECT*
2) the full size image is then read from S3 in the image_resize function 
and resized and renamed in the database - *PERFECT*
3) old large image get deleted from S3 - - *PERFECT*
4) it is then saved on this line   *self.image.save *and continues it all 
over again in a *infinite* loop! - ERROR  


def save(self, *args, **kwargs):
# delete old file when replacing by updating the file
try:
this = Profile.objects.get(id=self.id)
if this.image != self.image:
this.image.delete(save=False)
except: pass # when new photo then we do nothing, normal case
super(Profile, self).save(*args, **kwargs)
if self.image:
image_resize(self)


def image_resize(self):
import urllib2 as urllib
from cStringIO import StringIO
from django.core.files.uploadedfile import SimpleUploadedFile

'''Open original photo which we want to resize using PIL's Image 
object'''
img_file = urllib.urlopen(self.image.url)
im = StringIO(img_file.read())
resized_image = Image.open(im)


'''Convert to RGB if necessary'''
if resized_image.mode not in ('L', 'RGB'):
resized_image = resized_image.convert('RGB')

'''We use our PIL Image object to create the resized image, which 
already
has a thumbnail() convenicne method that constrains proportions.
Additionally, we use Image.ANTIALIAS to make the image look better.
Without antialiasing the image pattern artificats may reulst.'''
resized_image.thumbnail((100, 100), Image.ANTIALIAS)

'''Save the resized image'''
temp_handle = StringIO()
resized_image.save(temp_handle, 'jpeg')
temp_handle.seek(0)


''' Save to the image field'''
suf = 
SimpleUploadedFile(os.path.split(self.image.name)[-1].split('.')[0],
 temp_handle.read(), 
content_type='image/jpeg')
self.image.save('%s.jpg' % suf.name, suf, save=True)



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django save method in infinite loop, code review?

2013-03-01 Thread sparky
I did actually try that but if I do this...


# Resize if we have an image.
> if self.image:
> image_resize(self)
>
> super(Profile, self).save(*args, **kwargs)
>

then inside image_resize 'self' is the old image and I get a 404 error on 
the line...

 img_file = urllib.urlopen(self.image.url)
>


 

On Friday, March 1, 2013 2:52:23 PM UTC, Sergiy Khohlov wrote:
>
>  move your super up 
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
>
> On Fri, Mar 1, 2013 at 4:48 PM, sparky >wrote:
>
>> Django newbie :) I'm wondering if you *kind people* could help me work 
>> out how to solve a little issue I'm having :) I'm using *S3 storage* via 
>> the package 
>> django-storages
>> .
>>
>> The following code gets stuck in an endless loop. I know  just enough to 
>> know why, but not how to solve...
>>
>> *Remembering I'm a newbie*
>>
>>
>> This is what the the code I have written does so far
>>
>> 1) profile gets saves and image uploaded *(without the resize of course)*to 
>> S3 - 
>> *PERFECT*
>> 2) the full size image is then read from S3 in the image_resize function 
>> and resized and renamed in the database - *PERFECT*
>> 3) old large image get deleted from S3 - - *PERFECT*
>> 4) it is then saved on this line   *self.image.save *and continues it 
>> all over again in a *infinite* loop! - ERROR  
>>
>>
>> def save(self, *args, **kwargs):
>> # delete old file when replacing by updating the file
>> try:
>> this = Profile.objects.get(id=self.id)
>> if this.image != self.image:
>> this.image.delete(save=False)
>> except: pass # when new photo then we do nothing, normal case
>> super(Profile, self).save(*args, **kwargs)
>> if self.image:
>> image_resize(self)
>> 
>> 
>> def image_resize(self):
>> import urllib2 as urllib
>> from cStringIO import StringIO
>> from django.core.files.uploadedfile import SimpleUploadedFile
>> 
>> '''Open original photo which we want to resize using PIL's Image 
>> object'''
>> img_file = urllib.urlopen(self.image.url)
>> im = StringIO(img_file.read())
>> resized_image = Image.open(im)
>> 
>> 
>> '''Convert to RGB if necessary'''
>> if resized_image.mode not in ('L', 'RGB'):
>> resized_image = resized_image.convert('RGB')
>> 
>> '''We use our PIL Image object to create the resized image, which 
>> already
>> has a thumbnail() convenicne method that constrains proportions.
>> Additionally, we use Image.ANTIALIAS to make the image look 
>> better.
>> Without antialiasing the image pattern artificats may reulst.'''
>> resized_image.thumbnail((100, 100), Image.ANTIALIAS)
>> 
>> '''Save the resized image'''
>> temp_handle = StringIO()
>> resized_image.save(temp_handle, 'jpeg')
>> temp_handle.seek(0)
>> 
>> 
>> ''' Save to the image field'''
>> suf = SimpleUploadedFile(os.path.split(self.image.name
>> )[-1].split('.')[0],
>>  temp_handle.read(), 
>> content_type='image/jpeg')
>> self.image.save('%s.jpg' % suf.name, suf, save=True)
>>
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to create formset field but not used loop in template

2013-03-01 Thread C. Kirby
I do sometimes reference formset forms individually without the loop. 
Allows me to better create my layout.
As for your question Witold, list items in a template can take an index to 
select a single item. This will only work if you know how many forms are in 
your formset:

{{formset_create_company.[n].no_house}}

where [n] is the index of your form (1,2,3,4...)

On Friday, March 1, 2013 7:02:41 AM UTC-6, Daniel Roseman wrote:
>
>
>
> On Friday, 1 March 2013 11:43:22 UTC, Witold Greń wrote:
>>
>> When i create formset in template i must used loop "for":
>>
>> 
>>
>> How to create field but not used loop "for"? eg. {{ 
>> formset_create_company.form.no_house }}??
>>
>
> Can you explain why you don't want to use for? Seems perfectly sensible to 
> me, a formset contains multiple forms so you need to use a loop.
> --
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Experiences with A/B testing?

2013-03-01 Thread Tomás Solar Castro
Hi everyone

I want to make some A/B testing. I've searched for how to do this with 
django, and I found some extensions:


   - django-lean https://github.com/suckaplease/django-lean (seems 
   discontinued)
   - django-ab https://github.com/johnboxall/django-ab  (seems discontinued)
   - waffle http://waffle.readthedocs.org/en/latest/
   - gargoyle https://github.com/disqus/gargoyle
   - splango https://github.com/shimon/Splango

Last three have active development, but they are for feature flipping 
(only?). Maybe mixing that with google analytics or something could work?

Anyone have some experiences with A/B testing?

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: error in filling data in database through admin page

2013-03-01 Thread C. Kirby
It would be helpful to see the model definition(s) and the admin.py if you 
wrote one

On Friday, March 1, 2013 1:06:34 AM UTC-6, Avnesh Shakya wrote:
>
> hi, 
>  i have got one error during adding data in database though admin 
> page, actually it was working fine, but i made some attributes optional, 
> now it's generating error..
> i m adding m models.py ,
> error--  
>
> " needs to have a value for field "course" before 
> this many-to-many relationship can be used.
>
> plz help me..
>
> thanks in advance
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django save method in infinite loop, code review?

2013-03-01 Thread sparky
right *OK* now I get it. see, just needed a little push in the right 
direction...


so I moved super up
I then changed to use  resized_image = Image.open(self.image)
I then changed *self.image.save('%s.jpg' % suf.name, suf, save=False)

*and* BOOM! *all working!*

Thanks so much, this is so fun!
*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Daemonize django server

2013-03-01 Thread Tom Evans
On Thu, Feb 28, 2013 at 6:23 PM, Tim Johnson  wrote:
> I'm having a hell of a time getting fastcgi to work on my mac, so
> for the time being I'll just stick with using the django server.
>
> Is it possible to daemonize the server? I would prefer that in some
> cases.
>
> From https://docs.djangoproject.com/en/dev/ref/django-admin/
> I see daemonize as an option for runfcgi but not for runserver.
>
> thanks

I didn't reply to your fastcgi posts yesterday, as you were attempting
to have everything spawned by the web server, which is not how I have
my fastcgi sites setup. If you are happy with running the web app
separately yourself, then this recipe will work:

Apache httpd with mod_fastcgi:

RewriteCond %{REQUEST_URI} !^/media
RewriteCond %{REQUEST_URI} !^/
# repeat for any other directories you want httpd to serve
RewriteRule ^/(.*)$ /app.fcgi/$1 [QSA,L]
FastCGIExternalServer /path/to/your/htdocs/app.fcgi -socket
/path/to/your/webapp/run/app.socket

Then simply ensure you have started your app:

python project/manage.py runfcgi \
socket=/path/to/your/webapp/run/app.socket \
pidfile=/path/.../run/app.pid \
errlog=... outlog=... \
minspare=.. maxspare=...

For absolute clarity, there is *no* real file named 'app.fcgi'. It
does not exist, it has no contents, it is merely a location in
urlspace - although you specify it as a filespace location! - that is
used to specify to fastcgi to take over the request. This is the
opposite of wsgi!

Is there a reason you are not using wsgi by the way? This is the
preferred method of hosting python apps, we used fastcgi as we are not
only hosting python apps.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




django-registration vs Django 1.5

2013-03-01 Thread Xavier Pegenaute

Hi,

seems django-registration doesn't support properly the new user model 
from Django 1.5, any one know how to work around it, or at least some 
other application able to deal with Django 1.5?


Thanks,
Xavi

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django URLs with/without proxy server

2013-03-01 Thread Barun Saha
I have two Django apps (say, app1 and app2) hosted on the same machine 
using Apache mod_wsgi. These two apps are hosted on two different 
environments:

 1. On a physical server where only these two apps are hosted. They are 
accessed as http://www.example.com/app1/app1/ and 
http://www.example.com/app2/app2/.
 2. In the second environment there is a proxy server. A separate web page 
on that server is accessed as http://www.domain.com/. This links to the 
above two apps (now hosted on a single virtual machine) as 
http://www.domain.com/id1/ and http://www.domain.com/id2/

The URLconf file looks like:

urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^app1/', include('project.app1.urls')),   
)

The problem is, this URL configurations works in the environment 1, but not 
in the environment 2. Now, if I do something *crazy* in the environment 2 
such as  

 urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^app1/app1/app1/', include('project.app1.urls')),   
(r'^app1/app1/', include('project.app1.urls')),   
(r'^app1/', include('project.app1.urls')),   
 )

then the application works. In the env. 2, the app is accessed as 
http://www.domain.com/id1/app1/app1/.

I couldn't understand why we need to prefix app1 in the URL so many times. 
In other words, why (how) this works.

Could someone clarify on this? Also, note that all configurations need to 
be done on the virtual machine. I don't have access to the proxy server.

(Posted in Stackoverflow: 
http://stackoverflow.com/questions/15159134/django-urls-with-without-proxy-server)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django + Raspberry PI

2013-03-01 Thread Nicolas Emiliani
Hey guys!

Has anyone tried to run django + sqlite on a raspberry pi ? Any performance
issues ?

I'm about to start an app that provides a restful api and has to run on
RPI, it's going
to manage an automation service, so load is going to be pretty low.

Cheers.

-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django + Raspberry PI

2013-03-01 Thread Shawn Milochik
Yep, I got my full development environment for one of my company's
applications running on it with almost no problem. The one exception
was MongoDB, which is for x86 only, so I had to compile a fork, which
took about 10 hours on the Pi.

It was definitely pretty slow, but it works.

Our stack includes nginx, gunicorn, Redis, MongoDB, PostgreSQL,
supervisor, virtualenv, and probably other stuff I'm forgetting.

It is a computer, after all. Just slow, not too much RAM, and with an
ARM processor.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-registration vs Django 1.5

2013-03-01 Thread Johan Kock
Hi Xavi,

I'm wrestling with the same problem right now. 

There are a couple of pull request to solve this but until they are accepted 
I'm using this fork:

https://bitbucket.org/eire1130/django-registration

pip install https://bitbucket.org/eire1130/django-registration/get/tip.tar.gz

/Johan
 

On Mar 1, 2013, at 4:53 PM, Xavier Pegenaute wrote:

> Hi,
> 
> seems django-registration doesn't support properly the new user model from 
> Django 1.5, any one know how to work around it, or at least some other 
> application able to deal with Django 1.5?
> 
> Thanks,
> Xavi
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django-registration vs Django 1.5

2013-03-01 Thread william ratcliff
I believe that my patched version should also work:

https://github.com/williamratcliff/django-registration

Please let me know if there are problems--I should issue a pull request
(the patch is minor)


On Fri, Mar 1, 2013 at 11:07 AM, Johan Kock  wrote:

> Hi Xavi,
>
> I'm wrestling with the same problem right now.
>
> There are a couple of pull request to solve this but until they are
> accepted I'm using this fork:
>
> https://bitbucket.org/eire1130/django-registration
>
> pip install
> https://bitbucket.org/eire1130/django-registration/get/tip.tar.gz
>
> /Johan
>
>
> On Mar 1, 2013, at 4:53 PM, Xavier Pegenaute wrote:
>
> Hi,
>
> seems django-registration doesn't support properly the new user model from
> Django 1.5, any one know how to work around it, or at least some other
> application able to deal with Django 1.5?
>
> Thanks,
> Xavi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django IRC & sqlite3 .schema

2013-03-01 Thread Dorian Kiss
Cheers, I'm sorted on the IRC now. Before I asked I did look for the search 
button, everywhere except the huge search bar at the top. After I posted 
the question I found it, and found your previous answer about IRC, but 
unfortunately there was no option to delete or edit my topic.

As for the sqlite3 question: I've django-admin.py startproject mysite; 
configured mysite/settings.py and python manage.py syncdb. So, I have a 
sq3.db sqlite3 database in the outer mysite directory:
mysite/
manage.py
sq3.db
mysite/
__init__.py
settings.py
urls.py
wsgi.py

I've then tried to proceed by following: 'If you’re interested, run the 
command-line client for your database and type \dt (PostgreSQL),SHOW TABLES; 
(MySQL), 
or .schema (SQLite) to display the tables Django created.'

I don't know what the command-line client for my database is(I'm using the 
windows(DOS) 'Command Prompt', but after searching Google I came across the 
web page 'http://curioushq.blogspot.co.uk/2011/05/django-tutorial.html', 
which says: 
'So on the command prompt, I type in sqlite3 nameofdbcreated.db and then 
once inside, type in .schema to create and list the databases.' 

Though, when I enter 'sqlite3 sq3.db' from within either C:\ or my outer 
mysite folder I get the response: 'sqlite3' is not recognized as an 
internal or external command,
operable program or batch file.'

Of course, I haven't gotten any further than that.

I have wondered if this is because I need to set up a path inside the 
windows environment variables like I did(though apparently unnecessarily) 
for Django as a whole.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Converting Django app into a Desktop app

2013-03-01 Thread Kevin London
Oh okay, interesting. Thank you for following up. I'm going down the
Pyinstaller route, I think. Support for Django in Pyinstaller is so recent
that I'm hitting a number of snags, so I might need to go py2app if it
doesn't pan out yet. Thanks to everyone so far for their contributions,
this has been a very helpful thread in working through the distributing
problem.

*Kevin London*
**Light Iron
6381 De Longpre Avenue
Los Angeles, CA 90028
t: 323-472-8300
c: 858-603-9037
www.lightiron.com


On Fri, Mar 1, 2013 at 9:13 AM, Loai Ghoraba  wrote:

> actually I were busy in some other stuff lately, so I didn't try any :)
> plus I found that even if I tried then it will be useless to my needs,
> sorry :)
>
>
> On Fri, Mar 1, 2013 at 6:09 AM, Kevin London  wrote:
>
>> @Loai, how did Pyinstaller work out for you? Is that the route you took?
>>
>>
>> On Thursday, December 20, 2012 10:20:31 PM UTC-8, Loai Ghoraba wrote:
>>
>>> @Filib: thanks a lot, seems that is what I will need exactly :)
>>>
>>> On Fri, Dec 21, 2012 at 1:37 AM, Mike Dewhirst wrote:
>>>
 See also 
 https://us.pycon.org/2012/**sche**dule/presentation/393/by
  Ryan Kelly and his 'esky' package for safely updating distributed apps.
 There is a link to that and other items in the above pycon talk.

 Mike



 On 21/12/2012 9:55am, Filip Wasilewski wrote:

> Hi,
>
> On Tuesday, December 18, 2012 5:06:19 PM UTC+1, Loai Ghoraba wrote:
>
> Hi
>
> I am very comfortable with Django, and I was wondering about
> whether
> there is some way to convert a Django web app into a Desktop app
> (may be not 100%), so that I can distribute it to users. May be
> wrapping it in a light web server "if there is something like
> this".
>
>
> I've been recently going through the process of distributing Django web
> application with binary dependencies (NumPy/SciPy) as an one-click
> executable. I have evaluated several solutions and the most effective
> was creating a single-file binary package using PyInstaller
> (pyinstaller.org, development version with some modifications for
> proper
> dependency discovery). As for the web server I went with the
> pure-Python
> CherryPy server (cherrypy.org). See https://gist.github.com/**434925**
> 7  for
> sample server script.
>
>
> Filip
> en.ig.ma
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/**ms**g/django-users/-/**7umVeAxLLBAJ
> .
> To post to this group, send email to django...@googlegroups.com.
>
> To unsubscribe from this group, send email to
> django-users...@**googl**egroups.com.
>
> For more options, visit this group at
> http://groups.google.com/**group**/django-users?hl=en
> .
>

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To post to this group, send email to django...@googlegroups.com.
 To unsubscribe from this group, send email to django-users...@**googl**
 egroups.com.

 For more options, visit this group at http://groups.google.com/**group*
 */django-users?hl=en
 .


>>>
>> This e-mail is the property of LightIron Digital LLC. It is intended only
>> for the person or entity to which it is addressed and may contain
>> information that is privileged, confidential, or otherwise protected from
>> disclosure. Distribution or copying of this e-mail, or the information
>> contained herein, to anyone other than the intended recipient is prohibited.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/-VGqvHew35g/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
>
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> F

Re: Django + Raspberry PI

2013-03-01 Thread Nicolas Emiliani
Shawn,

It was definitely pretty slow, but it works.
>
> Our stack includes nginx, gunicorn, Redis, MongoDB, PostgreSQL,
> supervisor, virtualenv, and probably other stuff I'm forgetting.
>
>
Well you are running a pretty interesting and (heavy?) stack, I've read
about DB engines being slow. Thanks for the data.


> It is a computer, after all. Just slow, not too much RAM, and with an
> ARM processor.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Getting only the models related to my queryset.

2013-03-01 Thread Gabriel Koscky
Hi, I've been having some trouble with filtering the related models of a 
queryset,
and I'm not sure if I'm approaching this wrong or if Django can't actually 
do it.

Basically I have some models with ManyToMany relationships, like:

*class User(models.Model):
name = models.CharField()
class Product(models.Model):
name = models.CharField()
class Order(models.Model):
user = models.ForeignKey(User)*

*status = models.CharField()*

*products = models.ManyToManyField(Product, through='OrderProduct')
class OrderProduct(models.Model):
product = models.ForeignKey(Product)
order = models.ForeignKey(Order)
amount = models.IntegerField()*


And I want to get all the products bought by User1, so I'd do something like

*Product.objects.filter(order__status='completed', order__user=User1)*

Which then returns just Product1, but now I want the amount the user bought,

but it seems wrong to make another query like:

*Product1.orderproduct_set.filter(order__user=User1)*

And hit the database again to get data my first query can already bring me...


So what I want to know is, based on a queryset that filters by related models,

is there a way to get just the actual related models of my result?


Thanks,

Gabriel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Request for comments on a new Open Source Paas platform for Django

2013-03-01 Thread Patrick
Hi,

I'm building a Juju based Open Source Paas platform for Django and
I need your help because it is a hard task to make a PAAS system
that is flexible enough to deploy any projects and at the same time
simple to use.

For the ones that don't know Juju, it's a service orchestration software
compatible with LXC (local), EC2, HPCloud, OpenStack and Baremetal/Maas
developed by Canonical (the company that makes Ubuntu).

Check out the web site for more details: https://juju.ubuntu.com/

So quickly, here's how it would works:

After installing Juju and configuring it with for your favourite cloud 
provider you
will need to create a configuration file in the YAML format named 
my_django_conf.yaml
in this example::

  my_django_site:
  vcs: git
  repos_url: https://github.com/my_username/my_site.git 
  site_secret_key: abcdefgh123456789
  use_virtualenv: True

Then you will need these commands to bootstrap and launch all the servers::

  juju bootstrap

  juju deploy --config my_django_conf.yaml my_django_site
  juju deploy postgresql # or mysql,mongodb, etc
  juju deploy gunicorn # Or mod_wsgi, etc

  juju add-relation my_django_site postgresql
  juju add-relation my_django_site gunicorn

  juju expose gunicorn # Open the tcp port in the firewall

You will end up with 3 servers running. One will be the controller
and one for each service (django and the database). 
Gunicorn will be a special charm that will be installed on your Django 
server.
After that, adding a new Django node would be as simple as::

  juju add-unit my_django_site



As I said, where it gets tricky is how do I make the configuration flexible 
enough
and at the same time simple.

After looking at what was existing in Django's Paas world, I came with this:

1 - We need a configurable requirements files for both pip and apt-get. By 
default
it would be looking for package in there files at install time::

  requirements_pip_files: requirements.txt,requirements.pip
  requirements_apt_files: requirements.apt

and we could also configure extra packages by adding variables like this in 
the YAML file::

  additional_distro_packages: vim,emacs,etc
  additional_pip_packages: virtualenvwrapper,celery,South,etc

2 - I'm suggesting to use separate configurations files in a settings/ 
directory
so by default it will be injecting configuration in those files::

settings_database_path: settings/20-engine.py
settings_static_path: settings/20-static.py
settings_uploads_path: settings/20-media.py
settings_cache_path: settings/30-cache.py
settings_secret_key_path: settings/20-secret.py

I'm suggesting splitting settings because when the configuration is 
modified,
for some reason, it would be difficult and risky to parse settings.py and 
change only the right thing.

So instead, I would be using topic files rendered with templates.
So if you would need to do more advanced stuff you could just fork the charm
and modify the templates for your needs.

3 - Finally, I was thinking adding some options to execute custom scripts 
that
would run a various time during the deployment. Like after packages 
installation
,database configuration and static file configuration::

post_database_script:
type: string
default: |
  #!/bin/sh
  python manage.py syncdb --noinput
  python manage.py migrate --noinput
post_static_script:
type: string
default: |
  #!/bin/sh
  python manage.py collectstatic -v 0 --noinput

Note that this is not making unanimity so far.
There is several reasons that makes the scripts approach tricky:

* You don't want to execute these scripts every time a little detail change.
* You might need the database configuration to be ready for some script.
* You could be not using south
* You might want to import some initial data and maybe only once at install 
time.
* You could want to compress static files after running collectstatic
* etc

An other idea could be to use a Fabric plug-in that use Juju's database to 
connect
to the machines and run commands like this for example::

  fab -R my_django_site python manage.py pull

would pull the latest version of the site and reload the application on 
every
deployed Django machines.

The bottom line here is that it's not simple to find out what a standard
Django deployment (and is maintenance) looks like.

That being said, I'm really looking forwards for you comments and 
suggestions.

Patrick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Daemonize django server

2013-03-01 Thread Tim Johnson
* Tom Evans  [130301 06:44]:
> On Thu, Feb 28, 2013 at 6:23 PM, Tim Johnson  wrote:
> > I'm having a hell of a time getting fastcgi to work on my mac, so
<...>
> 
> I didn't reply to your fastcgi posts yesterday, as you were attempting
> to have everything spawned by the web server, which is not how I have
> my fastcgi sites setup. If you are happy with running the web app
> separately yourself, then this recipe will work:
> 
> Apache httpd with mod_fastcgi:
> 
> RewriteCond %{REQUEST_URI} !^/media
> RewriteCond %{REQUEST_URI} !^/
> # repeat for any other directories you want httpd to serve
> RewriteRule ^/(.*)$ /app.fcgi/$1 [QSA,L]
> FastCGIExternalServer /path/to/your/htdocs/app.fcgi -socket
> /path/to/your/webapp/run/app.socket
> 
> Then simply ensure you have started your app:
> 
> python project/manage.py runfcgi \
> socket=/path/to/your/webapp/run/app.socket \
> pidfile=/path/.../run/app.pid \
> errlog=... outlog=... \
> minspare=.. maxspare=...
> 
> For absolute clarity, there is *no* real file named 'app.fcgi'. It
> does not exist, it has no contents, it is merely a location in
> urlspace - although you specify it as a filespace location! - that is
> used to specify to fastcgi to take over the request. This is the
> opposite of wsgi!
> 
> Is there a reason you are not using wsgi by the way? This is the
> preferred method of hosting python apps, we used fastcgi as we are not
> only hosting python apps.
  Hi Tom :

  I would like to try out your recipe this weekend and I hope that
  you might be around to answer further questions. But first I will
  answer yours:

  FYI: I have been a pythonist for 10 years and a web programmer for
  17, but I have always worked in straight CGI, so this is new
  territory for me.

  At this time, I don't have a target for a django app, I am just in
  get-acquainted mode. If I test a django app on a remote server, it
  will be one hosted on hostmonster. Hostmonster does not provide
  mod_wsgi as I understand it.

  On down the road, I can foresee doing django projects on a
  non-shared server where I have full control over what I enable on
  apache and I am clear that in that case, wsgi will be the best
  choice.

  As for my mac :: unfortunately, I am kind of new to mac also,
  having used linux for the 12 years previous to getting this mac.
  Enabling fastcgi on my mac's apache had all kinds of problems, of
  which I don't at this time have time to elaborate on or to solve -
  although I am sure that is forthcoming. (some time)

  I hope that I can use your recipes as a talking point, and ask
  some further questions of you. Perhaps it is best that we
  'reboot' under a different thread subject - as in 'fastcgi
  recipe' and the generated content might be of some help to others
  as well.

  Thank you for your reply. I'm going to owe you a beer when this is
  all said and one.
  regards
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django IRC & sqlite3 .schema

2013-03-01 Thread Dorian Kiss
I figured it out after some more abstract Google searching. I had to 
download the sqlite3.exe, as it did not come with django, and then add it 
to my path.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Converting Django app into a Desktop app

2013-03-01 Thread Czarek Tomczak
Hi Loai,

Have a look at CEF Python that embeds Chrome browser:
https://code.google.com/p/cefpython/
You will need to run a web server to convert it into a desktop application, 
have a look
at CefBottleDesktop  that 
embeds CEF and runs a python web server along with
bottle.py  framework.

Also have a look at Python Desktop that embeds Internet Explorer browser and
Mongoose web server:
https://code.google.com/p/phpdesktop/wiki/EmbeddingOtherScriptingLanguages

I am the author of both projects.

Cheers,
Czarek.

On Tuesday, December 18, 2012 8:06:19 AM UTC-8, Loai Ghoraba wrote:
>
> Hi
>
> I am very comfortable with Django, and I was wondering about whether there 
> is some way to convert a Django web app into a Desktop app (may be not 
> 100%), so that I can distribute it to users. May be wrapping it in a light 
> web server "if there is something like this". 
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: error in filling data in database through admin page

2013-03-01 Thread Avnesh Shakya
ya i m adding now please help me

On Fri, Mar 1, 2013 at 8:43 PM, C. Kirby  wrote:

> It would be helpful to see the model definition(s) and the admin.py if you
> wrote one
>
> On Friday, March 1, 2013 1:06:34 AM UTC-6, Avnesh Shakya wrote:
>>
>> hi,
>>  i have got one error during adding data in database though admin
>> page, actually it was working fine, but i made some attributes optional,
>> now it's generating error..
>> i m adding m models.py ,
>> error--
>>
>> " needs to have a value for field "course" before 
>> this many-to-many relationship can be used.
>>
>> plz help me..
>>
>> thanks in advance
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




admin.py
Description: Binary data


models.py
Description: Binary data