How can we improve performance in the Admin when loading profile pages with ManyToMany fields?
We have five or so ManyToMany fields (with 10,000+ and growing total entires in each field, only a few are selected for any one profile) in our user profile. When we bring up the profile in the admin, the page takes a while to load and render and taxes django and the database more than we would like as admin loads all the field possibilities. Most of the time we use the admin to view the data, not make changes. Is there anything we can do to improve performance? -- Eric Chamberlain --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How can we improve performance in the Admin when loading profile pages with ManyToMany fields?
On Nov 14, 2008, at 4:00 PM, James Bennett wrote: > > On Fri, Nov 14, 2008 at 5:49 PM, Eric Chamberlain <[EMAIL PROTECTED]> wrote: >> We have five or so ManyToMany fields (with 10,000+ and growing total >> entires in each field, only a few are selected for any one profile) >> in >> our user profile. When we bring up the profile in the admin, the >> page >> takes a while to load and render and taxes django and the database >> more than we would like as admin loads all the field possibilities. > > Try reading the admin docs, specifically for raw_id fields. Perfect, thanks. -- Eric Chamberlain --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Has anyone used the django database as a backend for openldap?
Hi, We have various servers and tools that can use LDAP for users, groups, and authentication. The users and groups information we would like to use is in django. Has anyone used the django database as a slapd backend? Enabling OpenLDAP to serve up the django user information LDAP style. -- Eric Chamberlain, Founder RF.com - http://RF.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Securely storing passwords
On Feb 24, 2009, at 3:49 AM, LaundroMat wrote: > > Hi - > > I'm working on a small django app that allows users to interact with > other websites where they have an account. Ofcourse, using this app > means providing your username and password for the other website. > > What are the most secure ways of handling this information? I suppose > encrypting the passwords is one option, but are there any ways to > prevent people who have access to the app's source code and database > of retrieving user's names and passwords? If your app servers have access to the password decryption keys, then anyone with access to the app server also has access to the password decryption keys. The simplest solution is to use SSL to secure the traffic between the browser and the app server and some custom model methods to symmetrically (AES, twofish, or blowfish) encrypt and decrypt the data going into and out of the database. That would protect you against sniffing and a database compromise, but not an app server compromise. A more secure way to mitigate the risk, would be to split up functions, so public Internet facing app servers do not perform decryption functions or work with plaintext passwords. In that scenario, you could use an asymmetric key (ideally one per user or encrypted password) at the browser to encrypt the passwords. Secured backend servers would perform the asymmetric decryption and plaintext password handling functions. You still have problems if the backend servers are compromised, but they would be much easier to lock-down and audit. -- Eric Chamberlain, Founder RF.com - http://RF.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Need help optimizing a view, too many queries
Our view is taking too long to render, can anyone offer suggestions to improve its speed? There are 5830 profiles. Total query count: 23809 Total duplicate query count: 493 Total SQL execution time: 66.003 Total Request execution time: 142.931 class Profile(Model): id = UUIDField(primary_key=True) user = ForeignKey(User, verbose_name=_('user'), unique=True, null=True) partner = ForeignKey('Partner') call_records = ManyToManyField('CallRecord', verbose_name=_('call record'), null=True, blank=True, help_text='Calls made by the user') class Partner(Model): id = UUIDField(primary_key=True) name = CharField(max_length=255, help_text='The name for the partner') users = ManyToManyField(User, related_name='partner_users', null=True, blank=True, help_text='Users signed up specifically through this partner') providers = ManyToManyField('Provider', related_name='provider_partners', blank=True, null=True, help_text="Calling services owned by this provider.") calls = ManyToManyField('CallRecord', related_name='call_partners', blank=True, null=True, help_text='Calls made through this calling service.') class CallRecord(Model): id = UUIDField(primary_key=True) provider_account = ForeignKey('ProviderAccount', null=True, blank=True, help_text='The calling service, if any, the call was made through') provider = ForeignKey('Provider', blank=True, null=True, help_text='The calling service the call was made through') class Provider(Model): id = UUIDField(primary_key=True) name = CharField(max_length=255) class ProviderAccount(Model): provider = ForeignKey('Provider', help_text='The calling service this account works with') username = TextField() encrypted_password = TextField(db_column='password') user = ForeignKey(User, help_text='The user this calling service account belongs to') profiles = Profile .objects .filter(partner=request.partner,user__is_active=True).order_by('- user__date_joined') for p in profiles: p.provider_list = list( account.provider for account in ProviderAccount .objects .filter(user=p.user,provider__provider_partners=request.partner)) p.call_count = p.call_records.filter().count() return PartnerResponse(request, {'profiles': profiles}) PartnerResponse returns the view to the user, the template uses a for loop to iterate through the profiles. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Need help optimizing a view, too many queries
On May 7, 2009, at 10:36 AM, George Song wrote: > > On 5/7/2009 8:56 AM, Eric Chamberlain wrote: >> Our view is taking too long to render, can anyone offer suggestions >> to >> improve its speed? >> >> There are 5830 profiles. >> >> /Total query count:/ 23809 >> /Total duplicate query count:/ 493 >> /Total SQL execution time:/ 66.003 >> /Total Request execution time:/ 142.931 >> >> class Profile(Model): >>id = UUIDField(primary_key=True) >>user = ForeignKey(User, verbose_name=_('user'), unique=True, >> null=True) >>partner = ForeignKey('Partner') >>call_records = ManyToManyField('CallRecord', verbose_name=_('call >> record'), null=True, blank=True, help_text='Calls made by the user') >> >> class Partner(Model): >>id = UUIDField(primary_key=True) >>name = CharField(max_length=255, help_text='The name for the >> partner') >>users = ManyToManyField(User, related_name='partner_users', >> null=True, blank=True, help_text='Users signed up specifically >> through >> this partner') >>providers = ManyToManyField('Provider', >> related_name='provider_partners', blank=True, null=True, >> help_text="Calling services owned by this provider.") >>calls = ManyToManyField('CallRecord', >> related_name='call_partners', >> blank=True, null=True, help_text='Calls made through this calling >> service.') >> >> class CallRecord(Model): >>id = UUIDField(primary_key=True) >>provider_account = ForeignKey('ProviderAccount', null=True, >> blank=True, help_text='The calling service, if any, the call was made >> through') >>provider = ForeignKey('Provider', blank=True, null=True, >> help_text='The calling service the call was made through') >> >> class Provider(Model): >>id = UUIDField(primary_key=True) >>name = CharField(max_length=255) >> >> class ProviderAccount(Model): >>provider = ForeignKey('Provider', help_text='The calling service >> this account works with') >>username = TextField() >>encrypted_password = TextField(db_column='password') >>user = ForeignKey(User, help_text='The user this calling service >> account belongs to') >> >> >> profiles = >> Profile >> .objects >> .filter(partner=request.partner,user__is_active=True).order_by('- >> user__date_joined') >> for p in profiles: >> p.provider_list = list( >> account.provider for account in >> ProviderAccount >> .objects >> .filter(user=p.user,provider__provider_partners=request.partner)) >> p.call_count = p.call_records.filter().count() >> return PartnerResponse(request, {'profiles': profiles}) >> >> PartnerResponse returns the view to the user, the template uses a for >> loop to iterate through the profiles. > > Well, it seems like what you're really after is the ProviderAccount, > right? > > So you can just pass this to your template: > {{{ > accounts = > ProviderAccount > .objects > .filter(provider__provider_partners=request.partner).order_by('- > user__date_joined') > }}} > > In your template you can regroup accounts by user and you should be > good > to go, right? > We are after user information and a user can have 0 or more ProviderAccounts. The template looks like: {% for profile in profiles %} {{profile.user.email}} {{profile.user.first_name}} {{profile.user.last_name}} {{profile.user.date_joined|date:"Y M d H:i" }} {% for calling_service in profile.provider_list %} {{calling_service.name}}{% if not forloop.last %}{% endif %} {% endfor %} {% for sim in profile.sims.all %} {{sim.caller_id}}{% if not forloop.last %}{% endif %} {% endfor %} {{profile.call_count}} {% endfor %} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How can child objects inherit data from parents?
Hello, We're not sure how can we represent the following data structure in the django model? Grandparent Object First Name - NULL Last Name - NULL City - Anytown Ancestor Object - NULL Parent Object First Name - Bob Last Name - Smith City - NULL Ancestor Object - Grandparent Child Object First Name - Jill Last Name - NULL City - NULL Ancestor Object - Parent We'd like to be able to use the child object with the NULL fields coming from the ancestor objects. We need to update the parent field and have all the child objects return the new value. The parent object behaves like a template, some users have write access to the child, but not the parent object or some users may not have write access to all the child fields. We'd like to keep database calls to a minimum and avoid looping lookups if possible. Is there a better way to implement this? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How can child objects inherit data from parents?
On Dec 9, 2009, at 9:41 AM, bruno desthuilliers wrote: > On 9 déc, 14:10, Eric Chamberlain wrote: >> Hello, >> >> We're not sure how can we represent the following data structure in the >> django model? >> >> Grandparent Object >> First Name - NULL >> Last Name - NULL >> City - Anytown >> Ancestor Object - NULL >> >> Parent Object >> First Name - Bob >> Last Name - Smith >> City - NULL >> Ancestor Object - Grandparent >> >> Child Object >> First Name - Jill >> Last Name - NULL >> City - NULL >> Ancestor Object - Parent > > > Took me some times to understand this was about model instances, not > classes :-/ > > > First point, you have a tree structure. There are a couple ways to > handle trees in a relational model, each has pros and cons. The most > obvious one is the recursive relationship (also known as 'adjacency > list'): > > create table Person( > id integer primary key auto increment, > first_name varchar(50) NULL, > last_name varchar(50) NULL, > city varchar(50) NULL, > ancestor_id integer NULL > ) > > where ancestor_id refers to the Person.id of the 'ancestor'. > > The problem with this solution is that SQL has no way to let you > retrieve a whole 'branch' in one single query. > > Other solutions I wont explain here are the "Materialized Path" and > the "Modified Preorder Tree Traversal" (mptt). You'll find more on > this topic here: > > http://articles.sitepoint.com/print/hierarchical-data-database > > These solutions are somewhat more complex, but allow to fetch a whole > branch in a single query. OTHO, they usually imply way more work when > modifying the tree, so there's no "absolutely better" solution - which > one will yield the best results depends on your application's needs > and tree depth. > > >> We'd like to be able to use the child object with the NULL fields coming >> from the ancestor objects. > > I assume that what you mean is you want to lookup values on the > related 'parent' object for fields that have a NULL value in the > 'child' object. The usual way to handle this in Python is to use > computed attributes. > > >> We need to update the parent field and have all the child objects return >> the new value. The parent object behaves like a template, some users have >> write access to the child, but not the parent object or some users may not >> have write access to all the child fields. > > Hmmm... sorry but this part isn't quite clear to me. Care to provide a > bit more (or clearer) explanations ? (sorry for being that dumb). > >> We'd like to keep database calls to a minimum and avoid looping lookups if >> possible. > > Then you want a materialized path or MPTT. > >> Is there a better way to implement this? > > > "better" than what ??? You didn't say anything about your > implementation ? > Thanks for all the great info. Looks like if we go this route we would need MPTT. By a better way, I mean, should we store our data as a tree. We can limited the design to only two levels, a parent (default values come from here if not overridden by the child) and a child (overrides some of the values in the parent). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Trying to limit a ForeignKey in the admin site, but formfield_for_foreignkey isn't working
How do I get the default_provider field to only list providers that belong to this Partner? class Partner(Model): id = UUIDField(primary_key=True) ... default_provider = ForeignKey('Provider', null=True, blank=True) providers = ManyToManyField('Provider', related_name='provider_partners', blank=True, null=True) class PartnerAdmin(ModelAdmin): list_display = ('name', 'type', 'url') list_filter = ('type',) exclude = ['calls','providers' ] raw_id_fields = ('admins',) inlines = [ PartnerRegistrationInline, ] def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == "default_provider": kwargs["queryset"] = self.model.providers.all() return db_field.formfield(**kwargs) return super(PartnerAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) The code above generates an AttributeError: 'ReverseManyRelatedObjectsDescriptor' object has no attribute 'all' -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How do I filter an InlineModelAdmin ForeignKey?
I'd like PartnerRegistration's default_provider field to be filtered in PartnerRegistrationInline, like how Partner's default_provider field is filtered in PartnerAdmin. When I try the code below, I get a DoesNotExist exception in: self.fields['default_provider'].queryset = self.instance.partner.providers raise self.field.rel.to.DoesNotExist What am I doing wrong? class Partner(Model): id = UUIDField(primary_key=True) providers = ManyToManyField('Provider', related_name='provider_partners', blank=True, null=True) default_provider = ForeignKey('Provider', null=True, blank=True, help_text='The calling service used to make calls through by default when using this partner') class PartnerForm(forms.ModelForm): """ Filter and only show what belongs to this partner.""" def __init__(self, *args, **kwargs): super(PartnerForm, self).__init__(*args,**kwargs) self.fields['default_provider'].queryset = self.instance.providers class PartnerRegistration(Model): id = UUIDField(primary_key=True) partner = ForeignKey('Partner',unique=True) default_provider = ForeignKey('Provider',verbose_name='default calling service', help_text='User this calling service when response doesn\'t specify one.') class PartnerRegistrationForm(forms.ModelForm): """ Filter and only show what belongs to this partner.""" def __init__(self, *args, **kwargs): super(PartnerRegistrationForm, self).__init__(*args,**kwargs) self.fields['default_provider'].queryset = self.instance.partner.providers class PartnerRegistrationInline(StackedInline): model = PartnerRegistration form = PartnerRegistrationForm class PartnerAdmin(ModelAdmin): form = PartnerForm inlines = [ PartnerRegistrationInline, ] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How do I filter an InlineModelAdmin ForeignKey?
Thank you. The code fixed my problem. On Dec 16, 2009, at 1:48 PM, Tim Valenta wrote: > Well, you're probably getting the error on your 'extra' inlines. > self.instance is unbound in that case, and so self.instance.providers > cannot be looked up. > > I wrote a little thing to fetch a proper object though... just be sure > to include your parent model's field in your fields on the inline. > Then you can use this generic utility function... you can pick pieces > out of it if you think it wiser. I just took the sledgehammer to the > wall to get my task accomplished: > > def implied_inline_fk(form, implied_model_class, field_name=None): > if not field_name: > field_name = implied_model_class.__name__.lower() > try: > return implied_model_class.objects.get(pk=tuple(i[0] for i in > form.fields[field_name].widget.choices)[1]) > except IndexError: > # In the event that both the base 'original' object and inline > object don't exist, > # we need to just throw out the possibility of filtering values. > return None > except KeyError: > raise KeyError("'%s' must be included in the inline ModelAdmin's > 'fields' attribute." % field_name) > > > > You could then use this in your PartnerForm: > > class PartnerForm(forms.ModelForm): >def __init__(self, *args, **kwargs): >super(PartnerForm, self).__init__(*args, **kwargs) >if 'instance' in kwargs: ># Existing instance-- safe to use >self.fields['default_provider'].queryset = > self.instance.providers >else: ># 'extra' unbound object. Not safe. ># Must derive through some other means. >parentInstance = implied_inline_fk(self, PARENTMODEL, >'field_name_to_parent_model') >self.fields['default_provider'].queryset = > parentInstance.somelookup_to_provider_filter > > Note that sometimes this doesn't really work, depending on your model > hierarchy. You might have to throw in the towel on 'extra' inlines. > The key is to filter only when it's bound, and to work around the > filter if it's not bound. > > Tim > > > On Dec 16, 11:10 am, Eric Chamberlain wrote: >> I'd like PartnerRegistration's default_provider field to be filtered in >> PartnerRegistrationInline, like how Partner's default_provider field is >> filtered in PartnerAdmin. >> >> When I try the code below, I get a DoesNotExist exception in: >> >> self.fields['default_provider'].queryset = >> self.instance.partner.providers >> >> raise self.field.rel.to.DoesNotExist >> >> What am I doing wrong? >> >> class Partner(Model): >> id = UUIDField(primary_key=True) >> providers = ManyToManyField('Provider', >> related_name='provider_partners', blank=True, null=True) >> default_provider = ForeignKey('Provider', null=True, blank=True, >> help_text='The calling service used to make calls through by default when >> using this partner') >> >> class PartnerForm(forms.ModelForm): >> """ Filter and only show what belongs to this partner.""" >> >> def __init__(self, *args, **kwargs): >> super(PartnerForm, self).__init__(*args,**kwargs) >> self.fields['default_provider'].queryset = self.instance.providers >> >> class PartnerRegistration(Model): >> id = UUIDField(primary_key=True) >> partner = ForeignKey('Partner',unique=True) >> default_provider = ForeignKey('Provider',verbose_name='default calling >> service', help_text='User this calling service when response doesn\'t >> specify one.') >> >> class PartnerRegistrationForm(forms.ModelForm): >> """ Filter and only show what belongs to this partner.""" >> >> def __init__(self, *args, **kwargs): >> super(PartnerRegistrationForm, self).__init__(*args,**kwargs) >> self.fields['default_provider'].queryset = >> self.instance.partner.providers >> >> class PartnerRegistrationInline(StackedInline): >> model = PartnerRegistration >> form = PartnerRegistrationForm >> >> class PartnerAdmin(ModelAdmin): >> form = PartnerForm >> >> inlines = [ PartnerRegistrationInline, ] > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: authentication security
On Dec 18, 2009, at 7:58 PM, macdd wrote: > I am reading the django book. I just finished the chapter on > authentication. I get the jist of it. What I don't understand is the > overall security of authentication. If everything you do is passed as > plain text then it isn't very secure. Okay so https comes in. What I > don't understand is when to use it and when not to. It seems like if > you authenticate over https just for user credentials and then go back > to http (like yahoo) than someone could just ease drop your cookie and > be you, making logging in and out in any form pointless? > We use https for all our authenticated pages. Our primary concern was packet capture on public WiFi connections. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Anyone using django with XMPP for bots or components?
We are looking at adding some realtime features to a project and we are exploring using XMPP for the communication method. Is anyone using django with SleekXMPP or any other XMPP library to make bots or components? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Working for a startup.
On Apr 22, 2010, at 12:40 AM, Joe Goldthwaite wrote: > I’d like examples of large systems written in Django or other open source > frameworks. I’d also like stories about companies who tried .net switched > over to open source. It seems like there was a big Microsoft project on some > stock exchange program that failed but I can’t find any references to it. I > tried searching Google but it seems like it doesn’t differentiate “.net” with > the internet so trying to find .net failures only turned up stories about > internet downtime. Do you have any examples of large systems written in .Net? Amazon, Google, Facebook, twitter, et al. are not using .Net. -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django takes all my toys
It sounds like Django is working and your issue is with the web server configuration. In you case it sounds like there are two ways you could install Django, add a virtual host to the machine, or configure apache to serve Django from a subdirectory. Unless you have extra hostnames available, I'd go with the subdirectory option. Both configuration options have examples on the web. On May 10, 2010, at 6:31 PM, ah...@cs.ucla.edu wrote: > Hi, > > I don't know very much about django, except that a piece of software > that one of my colleagues developed requires it to function properly. > > My problem is as follows : I have inherited responsibility for > installing the aforementioned software on a pre-existing webserver > which already hosts more than one site. The server has been installed > and maintained by an ad-hoc group of researchers, insofar as I can > determine. I need to install deploy Django for the piece of software > on this server without clobbering any pre-existing websites. > > I have successfully* installed and configured** Django with Apache and > mod_wsgi and Python2.6 on a CentOS machine. However, when I enable > django in the apache configuration file, one of two things happens : > (1) the congratulations you installed django page appears on all or > most webpages on the server (2) the congratulations you installed > Django page is inaccessible. > > Neither of these outcomes solves my problems... > > What would be the recommended way to allow django and the rest of the > sites to coexist? Do I need virtual hosts and a separate URL? > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: group password
I would use auth.User as is. When a new user (no existing django session) enters the code, django creates a user account (random username and password) behind the scenes and logs in the user. Then the user is identifiable as long as they stay on that machine. Set the logout interval to whatever you need for the experiment duration. On May 19, 2010, at 2:50 PM, Junkie Dolphin wrote: > Hello everybody, > I am coding a django app for performing an online, anonymous > experiment system. The idea is that we give a login code to a group of > participants (e.g. students at our university) and tell them a > specific time window (usually a couple of hours) during which they can > login to the website using that code we gave them (hence no > registration required). Once they login the website randomly matches > pairs of participants for a game (the actual experiment). > > The key factor here is anonymity. We don't want participants to give > us any personal information, but still we need to identify each > anonymous user in order to do the random matching. > > What would be the best solution? I was thinking to use the builtin > authentication system but I don't know if it would be better to extend > django.contrib.auth.User or just use a plain form. > > -Giovanni > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: If is first time logging in
Anything wrong with adding a flag to the profile model? If the flag is not set, show the profile stuff? It keeps all the profile management in one model. The "flag" could even be a timestamp, so you could show the prompt again, if after X time the user has not added anything to their profile. On May 19, 2010, at 2:05 PM, Nick wrote: > I'm trying to figure out a way to see if it is a users first time > logging in after registering on the site. If it is then I will pass > them through some formsets, otherwise I let them go to their profile > page. > > I tried using date_joined == last_login but that doesn't work, as the > last login date changes the second you log in. > > Anyone ever done anything like this? > > Any thoughts? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
New project, debating postgresql or MySQL (Amazon RDS), does it matter to Django?
Hello, We have a new project and are debating whether to use postrgresql (Amazon EC2) or MySQL with InnoDB tables (Amazon RDS). It looks like our TCO would be much lower using Amazon RDS. Our past Django experience has been with postgresql, does MySQL InnoDB have any problems with Django's transaction middleware? We aren't using any custom fields, are there functional differences between the two databases that would impact how we use Django? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Indexing large CharFields with MySQL backend
Hello, In our model, we need to do lookups based on the user's XMPP JID. The JID can be up to 3071 characters long. The problem we have run into is that MySQL does not like to index columns that are that large. We are working on an implementation where we generate a hash and index the hash value, but we were wondering if anyone has already created a model field that addresses this problem and makes the database limitations transparent. -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
MultiPartParserError HTTP_CONTENT_LENGTH zero when uploading a file
We have an intermittent problem when uploading files. About one in five uploads fails, when the MultiPartParser receives an HTTP_CONTENT_LENGTH of zero. We are running Django with lighttpd and fastcgi, has anyone else encountered this problem? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django.contrib.auth
On Aug 3, 2010, at 6:45 AM, Seaky wrote: > Hi, > > I want to modify type of hash by default in auth (sha1 -> md5) and > change name of the table/model. > It's possible ? > It's possible, but modifying django.contrib.auth can be a pain, other apps rely on it a lot. It sounds like what you really want is a custom authentication backend so that you can authenticate against an existing table with MD5 passwords. -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Amazon S3 Boto
Take a look at django-storages, it's what we use to store audio files in S3. It's a pretty robust django storage backend with decent community support. On Aug 6, 2010, at 5:06 AM, almacmillan wrote: > Hi there, > > I am a total beginner to programming and Django so I'd appreciate help > that beginner can get his head round! > > I was following a tutorial to show how to upload images to an Amazon > S3 account with the Boto library but I think it is for an older > version of Django (I'm on 1.1.2 and Python 2.65) and something has > changed. I get an error: >Exception Type:TypeError >Exception Value: 'InMemoryUploadedFile' object is unsubscriptable > > My code is: > >Models.py > >from django.db import models >from django.contrib.auth.models import User >from django import forms >from datetime import datetime > >class PhotoUrl(models.Model): > url = models.CharField(max_length=128) > uploaded = models.DateTimeField() > > def save(self): > self.uploaded = datetime.now() > models.Model.save(self) > >views.py >import mimetypes >from django.http import HttpResponseRedirect >from django.shortcuts import render_to_response >from django.core.urlresolvers import reverse >from django import forms >from django.conf import settings >from boto.s3.connection import S3Connection >from boto.s3.key import Key > >def awsdemo(request): > def store_in_s3(filename, content): > conn = S3Connection(settings.AWS_ACCESS_KEY_ID, > settings.AWS_SECRET_ACCESS_KEY) > b = conn.create_bucket('almacmillan-hark') > mime = mimetypes.guess_type(filename)[0] > k = Key(b) > k.key = filename > k.set_metadata("Content-Type", mime) > k.set_contents_from_strong(content) > k.set_acl("public-read") > > photos = PhotoUrl.objects.all().order_by("-uploaded") > if not request.method == "POST": > f = UploadForm() > return render_to_response('awsdemo.html', {'form':f, > 'photos':photos}) > > f = UploadForm(request.POST, request.FILES) > if not f.is_valid(): > return render_to_response('awsdemo.html', {'form':f, > 'photos':photos}) > > file = request.FILES['file'] > filename = file.name > content = file['content'] > store_in_s3(filename, content) > p = PhotoUrl(url="http://almacmillan-hark.s3.amazonaws.com/"; + > filename) > p.save() > photos = PhotoUrl.objects.all().order_by("-uploaded") > return render_to_response('awsdemo.html', {'form':f, > 'photos':photos}) > >urls.py > >(r'^awsdemo/$', 'harkproject.s3app.views.awsdemo'), > >awsdemo.html > > > {{form.file.label}} > > {{form.file}} > > > > > I'd really appreciate help. I hope I have provided enough code. > > Kind regards > AL > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: what do you do to take your site down?
On Aug 6, 2010, at 8:36 AM, Margie Roginski wrote: > Could anyone give me some pointers as to how you deal with taking your > site down for maintenance? Is there some standard thing that people > do to redirect all page requests to some sort of "Sorry, the site is > down" page?Do you do this directly via apache or do you do it via > django? > We have the front end web server redirect all web traffic to a static maintenance page. If we are upgrading the site, it typically means that the database or the django app server is unavailable. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: MultiPartParserError HTTP_CONTENT_LENGTH zero when uploading a file
In our case, I've tracked the problem to the client library we are using, ASIHTTPRequest. The library is occasionally sending an incorrect Content-Length when configured to use persistent connections. On Aug 10, 2010, at 8:47 AM, Roger wrote: > I'm seeing the same symptoms. The rate is much lower than 1 in 5 - > maybe 1 in 100 - but definitely the same error. Were you guys able to > make any progress on a solution? > > On Aug 4, 1:17 am, hcarvalhoalves wrote: >> Now that someone else mentioned, yes, I believe we have the same >> problem. >> >> I run Django thru FastCGI to a Cherokee Web Server, and occasionally, >> uploads fail to continue (the traceback shows that the code hanged at >> consuming the input stream, then the connection got reset by the >> client's browser, raising EOFError). >> >> At first, I filled a bug against Cherokee, but it didn't turned out >> that we were able to narrow the issue. Now I know it's not related to >> the web server, as you run Lighttpd. >> >> The only things I can think of are, a bug on FastCGI (Flup), Django, >> or a bug only triggered when you run Django thru FastCGI. >> >> I've also ran my Django install with SCGI, and with different options >> (fork / threaded), but the intermittent error persists. SCGI still >> uses Flup though. >> >> This bug proved to be really, really hard to reproduce or track down. >> I only get it because I run a SaaS with dozens users uploading photos >> every day, and some requests happen to fail starting the upload and >> end 500'ing. >> >> What about filling a ticket against Django? >> >> On 2 ago, 18:49, Eric Chamberlain wrote: >> >>> We have an intermittent problem when uploading files. About one in five >>> uploads fails, when the MultiPartParser receives an HTTP_CONTENT_LENGTH of >>> zero. >> >>> We are running Django with lighttpd and fastcgi, has anyone else >>> encountered this problem? >> >>> -- >>> Eric Chamberlain > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Best OS - VPS environment
Dan, We also run CentOS 5 on our production servers and have various django projects running Python 2.6.2 & 2.7. I'd stick with an OS that you know and use virtualenv to isolate the python version to the django project. On Aug 16, 2010, at 1:54 AM, Dan wrote: > I have been using CentOS 5 to run Django sites with Apache + Mod WSGI > mostly in VPS environments. > > I want to upgrade to a new OS as CentOS runs an old version of python > and it seems that it's not so easy to upgrade it. > > What do people recommend? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: stream (large) files from the back-end via Django to the user?
On Aug 23, 2010, at 4:25 PM, Markus wrote: > > Surely the whole point of a content delivery network is to act as a > proxy for the data source. Buffering it through Django means it's no > longer a CDN, it's just a data store. > > Yes. The problem is that currently our CDN is based on Hadoop which serves us > really well for internal purpose. We can't make it accessible from the > outside because at the moment Hadoop is missing some crucial security > features. Still we want to serve some data from our internal CDN to the > outside even if for this part of the story our CDN would be just a data > store. The question is if this could be done efficiently? If "yes", how can > it be done? > Does django need to be in the loop for file download? Is there some reason why the web server can't mount and serve the files like any other static file structure? -- Eric Chamberlain, -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: App for Registration/Authorization which is Email & Password based (not username)
On Aug 26, 2010, at 9:31 PM, nobosh wrote: > Hello, I'm on day 7 learning Django and would appreciate any info > around getting my Django app started with a Registration/Authorization > which is Email & Password based (not username). I'll don't currently > have a need for usernames. Is there an app or a clean/smart way to > implement. I'm trying to avoid bad habits as this is my first step > after reading the book. > We've done a few apps that use email for auth. In some cases, we generate a random 30-character username, the odds of a collision are very low and we don't run into issues trying to truncate an email address so it will conform to the username field character and length requirements. In other cases, where we need a deterministic username, we base64 encode a UUID for the username. We try to not tie the username to a derivative of the email address, so we can avoid username collisions if the user changes their email address. Don't forget to add an index to the email field. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: iPhone posting FILEs = "Invalid content length"
We ran into the same error with ASIHTTPRequest, our fix was to turn off persistent connections. On Sep 30, 2010, at 3:55 AM, Danny Bos wrote: > > Hey there, > I've got a new error I'm totally stumped on. All searches are saying > it's a "http vs https" or similar. > I'd be keen to hear your thoughts. > > Basically I've got an iPhone app sending a POST to a django app, it > contains one FILE. > Every now and then (very sporadically, about 1 in 5) one fails and I > get the below message. > > > Exception Type: > MultiPartParserError > > > Exception Value: > Invalid content length: 0 > > > Exception Location: > /home/72999/data/python/django/django/http/multipartparser.py in > _init_, line 80 > > > Any ideas? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: design problem..how to store web page's data for later comparison
You may want to store a hash of the page and use that for the comparison, then if the user wants to see the difference between the two pages, pull up the full page. On Oct 11, 2010, at 3:07 AM, jimgardener wrote: > hi > I am trying to write an application that checks a web page today and > again checks it after somedays and compares them.For this purpose I > need to store the page data on these 2 occassions in my program . > > How can I do this?I can get the page data of current moment as a > string using urllib.urlopen and store it in a variable, say > current_page_data.But ,how do I store yesterday's data so that I can > compare the two?Do I need to store it as a field in database?(I am not > very familiar with database programming..I am using postgres for web > app development with django.So I don't know if storing such a large > string like that is possible). > > I considered writing the data to a file..but suppose a lot of users > want to do the comparison of 2 versions of many pages..?I would be > creating so many files =usercount * number_of_url_by_each_user .If > the time duration between 2 comparisons was some seconds/minutes then > I can just use 2 local variables andmay not need persistence.But ,to > compare data of yesterday and today I may need some such mechanism.. > I guess this may be a common problem and there may some solution for > this. > Can someone comment/suggest how this can be done? > thanks > jim > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: iPhone posting FILEs = "Invalid content length"
It did in our case. What configuration are you running? We are running lighttpd and fastcgi. On Oct 15, 2010, at 6:33 PM, Mike Krieger wrote: > Hey Eric! > > We're using ASI & Django and seeing the same thing. > > Was setting shouldAttemptPersistentConnection enough to make the > problem go away? About 1/50 of our requests fail with this bug. > > Thanks! > Mike > > On Oct 7, 11:21 am, Eric Chamberlain wrote: >> We ran into the same error with ASIHTTPRequest, our fix was to turn off >> persistent connections. >> >> On Sep 30, 2010, at 3:55 AM, Danny Bos wrote: >> >> >> >> >> >> >> >> >> >>> Hey there, >>> I've got a new error I'm totally stumped on. All searches are saying >>> it's a "http vs https" or similar. >>> I'd be keen to hear your thoughts. >> >>> Basically I've got an iPhone app sending a POST to a django app, it >>> contains one FILE. >>> Every now and then (very sporadically, about 1 in 5) one fails and I >>> get the below message. >> >>> >>> Exception Type: >>> MultiPartParserError >>> >>> >>> Exception Value: >>> Invalid content length: 0 >>> >>> >>> Exception Location: >>> /home/72999/data/python/django/django/http/multipartparser.py in >>> _init_, line 80 >>> >> >>> Any ideas? >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Django users" group. >>> To post to this group, send email to django-us...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> django-users+unsubscr...@googlegroups.com. >>> For more options, visit this group >>> athttp://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-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: XMPP based apps
We've done django based xmpp services and created middleware to enable django to manage and authenticate ejabberd users. On Oct 18, 2010, at 6:10 AM, Venkatraman S wrote: > Well, I havent Googled, but was wondering whether how one can integrated XMPP > based communications(PUNJAB?) etc with Django? > Has anyone tried this? Any good reads or pointers? > > -V- > http://twitter.com/venkasub > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Please help me figure out this UnicodeEncodeError
Hi, can anyone tell me how to work around this UnicodeEncodeError? >>> from hashlib import md5 >>> full_jid = u'e...@example.com/Eric\u2019s iPhone 3GS' >>> hash = md5(full_jid) Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 21: ordinal not in range(128) -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Trying to implement a unique default relationship between models
Hello, I'm trying to implement a default relationship between models. Each otherApp.Partner model can have zero or more Registration models. One Registration per otherApp.Partner can be flagged as the default (default_reg). What I would like is for the default_reg boolean to be configurable from the Admin. I've written up the code below. Save properly updates the other Relationships, but the Admin form validation won't allow (unique error) another Registration to be set as the default, until the first Registration is unflagged. How do I override the form validation or have it ignore the unique constraint, because it is handled in the model save method? Or is there a better way to do this? class BasePartnerModel(BaseRFModel): """ Adds the partner key to the model. """ partner = ForeignKey('otherApp.Partner') class Meta: abstract = True class Registration(BasePartnerModel): """ When a user registers with us before registering with a partner, we need to send the user's information to the partner. This model tracks where to send the registration information, and maps the results between the partner and us.""" # TrueNoneField from http://www.djangosnippets.org/snippets/1831/ default_reg = TrueNoneField(default=None,verbose_name=_('default'),help_text=_('Default registration if one is not specifed, if no default, first one is used.')) def save(self, force_insert=False, force_update=False): if self.default_reg is True: # if this is the new default, set others to False Registration.objects.filter(partner=self.partner).exclude(pk=self.pk).update(default_reg=None) super(Registration, self).save(force_insert, force_update) # Call the "real" save() method. class Meta: unique_together = (('partner','default_reg'),) -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: database password in settings.py
There's nothing special about settings.py. You could do something like: from Crypto.Cipher import Blowfish blowme = Blowfish.new(SECRET_KEY) DATABASE_PASSWORD = blowme.decrypt(ENCRYPTED_PASSWORD) Securing SECRET_KEY is left as an exercise for the reader. On Jan 5, 2010, at 11:10 AM, Eyüp Hakan Duran wrote: > Hi all, > > I am very new to django so please be gentle with me. I understand that > we need to define the password to login to the database in the > settings.py file. Although I know one can set the permissions of this > file to be not readable by others, I was just wondering whether there > is another option that is more secure. > > Regards. > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: handle astronomically high number of users via the new BigIntegerField and contrib.auth.user
On Jan 9, 2010, at 8:59 AM, G B Smith wrote: > Thanks, that is a good resource. So this is what I am going to do : - > -- modify the contrib.auth.models.user to explicitly include id = > models.BigIntegerField(primary_key=True) > -- modify the contrib.auth.models.user.id field in the database using > creecode's method above or via the mysql shell or phpmyadmin or other > tools (still deciding) > > I am pretty sure this is going to have zero side-effects. If someone > knows otherwise, would be helpful to have that information. > If your going to go to all that trouble, you may as well use a UUID field instead. We went with UUID, because we didn't want membership counts to leak via an autoincrementing integer. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: handle astronomically high number of users via the new BigIntegerField and contrib.auth.user
We used one of the UUID fields from djangosnippets.org <http://www.djangosnippets.org/snippets/335/>. On Jan 9, 2010, at 6:56 PM, G B Smith wrote: > Eric, could you explain how this UUID implementation was achieved? > Django doesn't have a built-in UUID, so I can only guess that you used > a varchar field within Django. ? > > On Jan 10, 2:29 am, Eric Chamberlain wrote: >> On Jan 9, 2010, at 8:59 AM, G B Smith wrote: >> >>> Thanks, that is a good resource. So this is what I am going to do : - >>> -- modify the contrib.auth.models.user to explicitly include id = >>> models.BigIntegerField(primary_key=True) >>> -- modify the contrib.auth.models.user.id field in the database using >>> creecode's method above or via the mysql shell or phpmyadmin or other >>> tools (still deciding) >> >>> I am pretty sure this is going to have zero side-effects. If someone >>> knows otherwise, would be helpful to have that information. >> >> If your going to go to all that trouble, you may as well use a UUID field >> instead. We went with UUID, because we didn't want membership counts to >> leak via an autoincrementing integer. >> >> -- >> Eric Chamberlain, Founder >> RF.com -http://RF.com/ > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Insert AUTOMATICALLY random string in username field
On Jan 14, 2010, at 6:45 AM, nameless wrote: > > > I want username field is automatically filled with this value: > > username = str(n); > > where n is a number of 10 digits ( autoincremented or random ). > > . > > I tried to add this in save method: > > username = str(random.randint(10,99)) > > but there is a collision problem when n is the same for 2 users > ( although rare initially ). > > . > > How do I do this ? > We did something like: def register_user(email, password, first_name=None, last_name=None, agree_to_eula=True): def generate_username(): """Generate a random 30-character username. Username can only be alphanumeric or underscore.""" return ''.join([choice(string.letters + string.digits + '_') for i in range(30)]) email = email.strip() if not email_re.search(email): raise InvalidEmailAddressExcept if len(password.strip()) < 6: #TODO: pass password length info back to exception, so it's not hard coded in two locations raise InvalidPasswordExcept try: user = authenticate_user(email,password,agree_to_eula) except AuthenticationFailedExcept: raise AccountExistsAuthenticationFailedExcept except UserNotFoundExcept: # we need to create this user while True: try: user = User.objects.create_user(username=generate_username(), email=email, password=password) except IntegrityError: # this means the username already exists loop and try again with a new username continue else: # we successfully created the user, leave the loop break if first_name: user.first_name = first_name if last_name: user.last_name = last_name user.save() profile = Profile(user=user) if agree_to_eula: profile.agree_to_eula() profile.save() else: profile = user.get_profile() return {'user': user,} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Anyone have provisioning documentation for a LeadTek BVA8055?
Hi, A friend has a few hundred LeadTek BVA8055's and need to know how to bulk provision them. There isn't much documentation on the web. Anyone know how to bulk provision these devices? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Only Email + Password ( without username )
On Jan 14, 2010, at 2:44 AM, nameless wrote: > I want to use "id" as identifier for each user. So every user will > have an url like this: > > http://www.example.com/827362 > > I don't want username for my project. > So, if I can't delete it, I think to insert email in username field > and I don't want another identifier in username field as random > strings :P > In this case I don't have to create a custom backend. > Is a good idea in your opinion ? > It's not a good idea, unless you want to do a lot of customization. Username is unique, 30 characters, and only allows A-Za-z0-9_, no @ or -. You are better off generating a random unique value for username and authenticating on email address.-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Save, Signals and Models
On Jan 15, 2010, at 4:22 PM, Victor Loureiro Lima wrote: > Here is the deal: > > class MyModel ( models.Model ): > title = models.CharField( max_length = 100 ) > only_me = models.BooleanField( default = False ) > > Question: Whats the proper way to guarantee that no matter how many > MyModel's are available in the database, only one of them > will have the only_me set as True? To further clarify things: In the admin, > whenever I check the only_me checkbox, and save my model, all other models of > this class will have to have its own only_me field set to false. > > As far as I know, there is no other way of doing this unless I iterate over > all MyModel' s objects and uncheck them if they are checked, save them, then > afterwards check the model that I am actually saving setting the only_me > field to True. > > I tried doing this on the actual save() of the model, no success. Everytime > I called save on iterated objects, I, of course, got the maximum recursive > depth error thrown at me. > Fair enough, I quickly thought about signals, hooking my function to > post_save(), however I inevitabilly stumbled upon the same > problem: When I called save() on the iterated objects the post_save signal > got sent, I would step again in the same function, thus > no cookie for me. > I jumped over to overriding AdminForm' s save() method, so that I would > iterate there on the models unchecking them if necessary, and them returning > the proper object, but I stopped that and I said to myself that I must be > doing something really stupid, so Im coming to you guys: What would the > propper way of doing this? > def save(self, force_insert=False, force_update=False): if self.only_me is True: # if this is the new default, set others to False MyModel.objects.exclude(pk=self.pk).update(only_me=False) super(MyModel, self).save(force_insert, force_update) # Call the "real" save() method. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is there a way to access a field's verbose_name from a object_list generic view template?
I'm using the object_list generic view and it seems there should be a way to pull the field verbose_name from the model, without having to hard code the name in the template. Any suggestions? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: CheddarGetter module for Django/Python - easy recurring billing
On Feb 1, 2010, at 1:11 PM, Jason Ford wrote: > Anyone who's built commercial web app knows that payment processing > can be one of the toughest pieces to put in place - and it can > distract you from working on the core functionality of your app. > CheddarGetter is a web service that abstracts the entire process of > managing credit cards, processing transactions on a recurring basis, > and even more complex setups like free trials, setup fees, and overage > charges. > > We're using CheddarGetter for FeedMagnet.com and we thought the Django > community in general could benefit from the module we wrote to > interact with it. More just just a Python wrapper for CheddarGetter, > pycheddar gives you class objects that work a lot like Django models, > making the whole experience of integrating with CheddarGetter just a > little more awesome and Pythonic. > > - Jason Jason, We are looking at recurring billing systems, could you give some more info on why you chose CheddarGetter over Paypal or Amazon FPS? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Bulk adding permissions from QuerySet failing, what am I doing wrong?
Hi, This is my first time working with groups and permissions. I'm trying to bulk set permissions on a group: apns_users, created = Group.objects.get_or_create(name='APNS Users') if created: # set permissions permissions = Permission.objects.filter(codename__in=['add_app','change_app','delete_app','change_notification','delete_notification','send_notification']) apns_users.permissions.add(permissions) but the last line generates the following error: Traceback (most recent call last): File "", line 1, in File "/Users/eric/working/rfapns/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/db/models/fields/related.py", line 430, in add self._add_items(self.source_col_name, self.target_col_name, *objs) File "/Users/eric/working/rfapns/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/db/models/fields/related.py", line 497, in _add_items [self._pk_val] + list(new_ids)) File "/Users/eric/working/rfapns/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) ProgrammingError: can't adapt What am I doing wrong? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there a way to access a field's verbose_name from a object_list generic view template?
On Feb 6, 2010, at 2:53 AM, Atamert Ölçgen wrote: > On Saturday 06 February 2010 12:23:16 Dennis Kaarsemaker wrote: >> On do, 2010-02-04 at 11:01 -0800, Eric Chamberlain wrote: >>> I'm using the object_list generic view and it seems there should be a >>> way to pull the field verbose_name from the model, without having to >>> hard code the name in the template. >> >> model_class_or_instance._meta.verbose_name >> unicode(model_class_or_instance._meta.verbose_name_plural) >> > You can't access attributes that start with an underscore from templates. A > custom tag or filter should do it. > > Alternatively computed value of verbose_name can be passed to the view via > extra_context. Check the docs. > > What about the verbose_name and help_text of each field in the model? I want to use the verbose_name in a list view table column header. Is there a way to get the verbose_name from a QuerySet? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Creating new Thread in a view?
On Feb 17, 2010, at 9:36 AM, justind wrote: > > What is a better solution to this problem? Actually, I feel like I > can't solve it because I lack an understanding at what's happening > where Django touches Apache and I'd like to fill that gap, so in > addition to help with this particular problem, descriptions of what's > going on at apache/mod_wsgi process level and how that interacts with > me spawning threads etc (or pointers to docs) would help me out and be > appreciated. Take a look at pyapns. It holds opens a socket to Apple's push notification service and works with django. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Lighttpd and Django
On Feb 23, 2010, at 8:56 PM, tsuraan wrote: > I'm trying to run django with lighttpd 1.4 and fastcgi. I'm using the > normal recipe that has a rewrite rule to convert all requests but a > few into requests for /foo.fcgi$1, and then I have the fastcgi server > tied to that base. The problem that I have is that in django, all my > request.path variables have the /foo.fcgi prepended to them. What do > I need to do to get rid of this? Is there a variable in settings.py > that strips leading strings out of the request.path, or does somebody > know a way to get lighttpd to hide it? Under lighttpd 1.5 there's a > _pathinfo variable that can be used to get rid of the leading stuff, > but lighttpd 1.4 doesn't seem to have that, and lighttpd 1.5 is giving > me other problems. > It's in the documentation at: <http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#forcing-the-url-prefix-to-a-particular-value>. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django in the enterprise?
On Feb 24, 2010, at 6:23 AM, Steven Elliott Jr wrote: > Dear friends, > I apologize for writing this type of question to the community but I would > appreciate any information you could pass on considering the breadth of > knowledge within this group. > I know that the word “enterprise” gives some people the creeps, but I am > curious to know if anyone has experience creating enterprise applications, > similar to something like say… Java EE applications, which are highly > concurrent, distributed applications with Django? I know Java has its own > issues but its kind of viewed as THE enterprise framework and I think that’s > unfortunate. > Some people say that Rails is a good replacement for Java EE but what about > Django? Has anyone ever used it in this context? You only ever see pretty > standard websites on djangosites.org and it seems like its capable of so much > more. I am planning on scrapping some of our old systems which are written > mostly on ASP.NET and some Java for something more easily maintainable. I > started using Django for some other applications and find it to be fantastic > for what I am using it for (Corporate news, intranet, etc.) internally but > what about something like… an accounts receivable system, or a billing > system, etc. > I would hate to see a framework such as this pigeon-holed into a category it > doesn't need to be. It seems to be used for social media/networking, > content-heavy sites, not so much data processing, etc. I feel that it has all > the elements needed to start down this path. Anyone have any thoughts? > The term "enterprise", is pretty loaded. I've managed some really shitty "enterprise" apps, like Peoplesoft and Siebel CRM. Django can definitely do more than serve up websites. We use django to run our call routing infrastructure. Our main app does have a mobile web interface for making calls, but the backend telephony servers also communicate with Django via web services. Django does all the call routing logic. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: LDAP/AD Persistent authentication
On Mar 1, 2010, at 8:05 PM, valhalla wrote: > Hi All, > > I am looking for a relatively secure way to allow a logged in user > (currently auth via ldap to AD) to use their AD credentials to search > AD. > > I have plenty of code for how to search AD but no way that I can see > of running that code as the user. > > Any ideas? > Store the user's credentials, not very secure, or use kerberos for authentication and use the token in the ldap query. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Storing API Passwords
On Mar 1, 2010, at 2:56 PM, Chris wrote: > Hello, > > When working with photo API's such as twitpic, what is the best way of > storing the password? > Since the password needs to be sent in its natural form, hashing is > not an option. I read recently heard that a company was held > accountable (sued) for not encrypting their user's API passwords and > would rather be safe than sorry. I haven't been able to find an > effective way of doing so. Also I am using Postgres as my DB. > > Any suggestions? > We encrypt passwords in the model before storing them in the database. For security reasons unique to our application, we don't have the model decrypt the passwords. Our backend pulls the encrypted password from Django and it decrypts the password before use. We use asymmetric encryption, so a compromise of our web servers and our database servers can not result in decryption of all the stored passwords. In our case, we deal with something of more value than Photographs. If you're only dealing with photographs; not personally identifiable information, credit card numbers, or medical information, I would use symmetric encryption as some of the other posters have mentioned. I wouldn't worry about getting sued, what kind of damages would people have and your EULA should already limit your liability. -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: python-ldap: searching without specifying an OU?
On Apr 22, 2008, at 9:27 AM, hotani wrote: > > I am attempting to pull info from an LDAP server (Active Directory), > but cannot specify an OU. In other words, I need to search users in > all OU's, not a specific one. > > Here is what works: > > con = ldap.initialize("ldap://server.local";) > con.simple_bind_s('[EMAIL PROTECTED]', pass) > result = con.search_ext_s('OU=some office, DN=server, DN=local', The search should be DC=server, DC=local. -- Eric Chamberlain RF.COM http://RF.COM/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: maultiple .js files for debug and one minimized .js for production
We serve the static files from Amazon S3. -- Eric Chamberlain, Founder RingFree Mobility Inc. On Nov 8, 2011, at 1:46 AM, Gelonida N wrote: > Hi, > > > I'm having an rather weak (CPU) server accesible over a rather slow network. > > Therfore my plan is to use > multiple readable debuggable css files for debugging and > a single, minizmized .js for for production. > > This will affect some of my templates. > > How do you handle this setup in your projects. > > If statements in the templates? > multiple template files and copying over one or the other? > ??? > > In order to build the minimized files? > Is there any 'intelligent' plugin, which can locates and minimizes all > the .js files or do you go for a make file like approach or just a > simple script (finding / minimizing) > > Thanks in advance for any suggestions. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Which Linux distro to use on EC2?
For stock web serving stuff, like what you list, we use the Amazon Linux AMI. Amazon handles the optimization and compatibility issues and they are pretty responsive about adding new packages to the distribution. For more specialized applications (VoIP infrastructure, XMPP server), where Amazon doesn't have packages already in the distro we use CentOS. If your time is limited, I'd also recommend using Amazon RDS rather than managing your own MySQL server. -- Eric Chamberlain, Founder RingFree Mobility Inc. On Nov 13, 2011, at 11:56 AM, ydjango wrote: > I am setting up nginex, apache, python django, mysql based application > on EC2. I expect high web traffic and high mysql query usage. Mysql > and web server will on seperate servers. > > Which linux distro should I use for heavy production use - Ubuntu, > Centos or Debian? > > Does it matter? > > I see most instructions on web is using Ubuntu and it seems it is > considered easiest to set up. But I read somewhere that Ubuntu is not > for server use. What is the downside if I chose ubuntu? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: (fundamental) problem with password reset in 1.x: URL's become too long
We haven't used it for the password reset, but we've modified this short url code <http://code.activestate.com/recipes/576918-python-short-url-generator/> to reduce the length of our urls. -- Eric Chamberlain, Founder RingFree Mobility Inc. On Nov 15, 2011, at 7:11 AM, Bram de Jong wrote: > Hmm, > > We have 2 milion users and this isn;t really a good solution for us... > > Does anyone else have an alternative password-reset app which doesn't > use as many characters as the default one? > > - bram > > On Mon, Nov 14, 2011 at 4:57 PM, creecode wrote: >> Hello Bram, >> >> It's been awhile since I've had this problem. I don't think it is possible >> to totally solve the issue but it can be reduced. The problem is not Django >> but rather how email is handled from point to point. What I do is always >> put urls on a line by themselves and I put two empty lines above and below. >> That way is very much easier to see a url wrapping problem. I also put a >> note in the email about the url wrapping problem and if the link doesn't' >> work ask the user to make sure the whole url is in the address field. In >> addition I add that they may need to manually copy and paste. I also have a >> template email ready to go when a support question of this nature comes in >> that I can shoot off reiterating what the problem might be and a possible >> solution. >> >> If you go this route let us know how it works for you. >> >> Toodle-lo... >> creecode >> >> -- >> 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/-/JF1FmBDYIFoJ. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > http://www.samplesumo.com > http://www.freesound.org > http://www.smartelectronix.com > http://www.musicdsp.org > > office: +32 (0) 9 335 59 25 > mobile: +32 (0) 484 154 730 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Encrpting urls to hide PKs
On May 9, 2011, at 11:43 AM, ALJ wrote: > I was really looking for something lightweight. I didn't really want > to have to change the model structure to include a UUID ... although I > realise that this seems to way to go. I really just wanted to avoid > any 'opportunistic' attempts at extracting the data. The data itself > isn't critical and not worth the effort of going to great lengths to > crack any encryption I would put in. I was tempted to just use base64, > perhaps joining the PK and the postcode for example. That might be > enough just to obfuscate the id a bit and have a pseudo dual key. > > Oh well. > > Thanks anyway. > We needed a similar way to obfuscate publicly accessible objects and we didn't want usage information leaked by exposing the public key. We found and have been using short_url for over six months now. We use <http://www.michaelfogleman.com/2009/09/python-short-url-generator/> to generate short URL's from the primary key (integer). The short_url code is handy, because it doesn't need any extra columns in the database and it is pretty hard for users to reverse engineer the primary key id from the short URL. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Looking for recommendations to replace vBulletin with a django based forum
Hello, We are thinking about replacing our low-usage vBulletin forum with a django integrated forum. Has anyone used djangobb, pybb, or askbot? -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: using django on a server?
Cloud computing is basically resources that you don't have to pay for when you don't use them and no long-term commitments. We use Amazon Web Services and can change our setup on an hourly basis. We just finished consolidating some low utilization servers with Amazon EC2. We cut our costs down to about $.035/hr. And we really like that we can turn on and off development/testing servers and only pay for them when we need them, those are currently running about $.007/hr. We also leverage Amazon to serve our static files (javascript, image & css) from S3 and CloudFront. That traffic doesn't even hit our servers. On May 9, 2011, at 8:33 PM, raj wrote: > I'm sort of new to all of this, why cloud computing? What exactly is > the advantage of it. I'm not quite sure how all of this works. I > looked at the rackspace cloud website, and it looked confusing. Like a > server is like greater than $750 a month. I'm not really connecting > all the dots together. I don't really understand your second statement > either... I really want to learn all of this stuff. Please help. Thank > you! > Sincerely, > -Raj > > On May 9, 10:38 pm, Greg Donald wrote: >> On Mon, May 9, 2011 at 6:25 PM, raj wrote: >>> what hosting websites >>> would handle it? >> >> Any host that does cloud-based virtual servers will work. I use >> Rackspace Cloud. >> >> Put on your sysadmin hat, spin up an instance and go. No real need to >> depend on a host to "support" anything nowadays. >> >> -- >> Greg Donald >> destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Virtualized Django app image for dev replication?
On May 18, 2011, at 7:30 PM, ydjango wrote: > I am thinking of creating a virtualized image of my complete django > app with mysql so that I can clone/copy it on developers, qa and demo > laptops. That way I do not have to do greenfield install on each > developer computer which can take many hours. > > Any suggestions on what should I use - 1) vmware server, 2) vmware > desktop 3) Xenserver or any other . Any experiences? > > I have not used any of these VM technologies. > > Note: It is only for dev and testing use and it is not for production > use. So free products are preferred. It's not free, but we use Amazon EC2. It's like having vmware, but you don't have to manage the host box. Micro instances are cheap and you can configure them to either throw away data when powered down or save the data until the next time you need the box booted. -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django deployment
On May 19, 2011, at 11:40 AM, Shawn Milochik wrote: > There are a lot of options for this. > > One way is as you described. Another would be to serve the images from > another server entirely, like Amazon's S3. > > It depends on how you want to do it and what resources you have available. > > If you specifically want to know whether there are additional advantages to > using nginx if you still choose to use Apache to serve Django then maybe > someone else knows -- I don't have much experience with Apache. If it was my > setup I'd drop Apache entirely and just use nginx + gunicorn. Apache is too > heavy and complicated (in my opinion), and completely unnecessary when > hosting a Django site. > > Remember that nginx is technically a reverse proxy, which means it doesn't > serve the exact same purpose as Apache. It functions great for proxying all > your incoming traffic to the proper service. > Shawn, What do you like about gunicorn vs. fastcgi? How does it compare resource wise? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: how to save image in postgreSQL database
On May 19, 2011, at 6:30 AM, Ram wrote: > hello everyone i am studying python for my college project in which i > am sending some text and image in URL i want to store it to postgreSQL > database i know how to read data from URL but not about images how can > i perform it please help. Storing BLOBs in postgres can be a pain and storing the images locally doesn't scale well. We ended up using django-storages. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Experiences with virtualenv + Django?
We run CentOS on our servers and use virtualenv for each of our various django projects (multiple projects on one server), we haven't had any issues, but we use fastcgi between the web server and django. On May 23, 2011, at 7:00 PM, John Crawford wrote: > I'd like to know what kind of experience people have had, in using > virtualenv (to run a particular version of Python on a VPS) with > Django, and related packages? Not *just* Django (and Python), I'm > fairly sure that will work, but all the other bits and pieces that > tend to be required, like mod_wsgi, or mysqldb_python, and so on? > > Is virtualenv really effective, or does it turn out to be a nightmare > to get everything working correctly? I've been looking around the web > (particularly StackOverflow), and it like more like a nightmare. :( > > The VPS I am using, turns out to run on CentOS, which uses Python 2.4 > for everything, alas. So either I downgrade all my existing 2.6 code > to 2.4, or I install 2.6 on the VPS without breaking it, which would > require virtualenv. (Or changing hosting, which I'm also seriously > considering...) > > John C> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Synchronize method or model field access
On May 25, 2011, at 11:19 AM, Pawel R wrote: >> Synchronise what with what? > > Synchronize with other threads. I need this method to be invoked by only one > thread at a time. > >> "It doesn't work" is utterly useless. What does it do? > > It lets more than 1 thread to invoke this method at a time. > >> How does that differ from what you were expecting? > > I want only one thread to access this method. I would push the atomic updates to the database or use a queue with a single worker. Thread level locking doesn't scale across processes or servers. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to create user on mobile app for Django site?
On May 31, 2011, at 4:35 AM, Ivo Brodien wrote: > What is the correct way to do the following: > > 1) Mobile App from which a user can create a user/profile on the Django site > 2) Allow authenticated users to create on the site and query personalized > data from the site > > This is what I guess I have to do: > > 1) Create a REST API (probably with e.g. django-piston) on at the Django > site for creation and authentication > > How would I authenticate against the Django site? > > When I use URL connections from the mobile app do I always have to send the > credentials or can the Django site identify me by storing session cookies on > the client just like as if the mobile app would be a browser? > We've managed app authentication a few ways, depending on whether the end-user needs to be aware of the authentication or not. In some cases, we've used django-jsonrpc (sends username and password with each request, no session cookies) and for others, we've used piston with basic authentication and ASIHTTPRequest. Currently, we are looking at tastypie, piston is currently bogged down with a who will maintain it and where debate. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: VERY cheap django hosting?
We use Amazon AWS. If you register a new account, you can get free service for a year on their lowest tier. On Jun 7, 2011, at 11:30 PM, raj wrote: > Hey guys, > Just wondering if you could give me some hosts that are very cheap for > django hosting? Is hostgator any good? I really don't know what to > look for in a host. A lot of people are recommending web faction, but > its around $9 bucks a month. I was looking in the $5 bucks a month > range. Any ideas? Thank you. > -Raj -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is there anyway to put a Django site into maintenance mode using fabric?
We make the change at the web server and redirect all traffic to a static page. If the site is down for maintenance, then the middleware won't work either. On Jun 10, 2011, at 9:24 AM, Garth Humphreys wrote: > I'm using the MaintenanceModeMiddleware to put my site into > maintenance mode, but I was wondering if there is a way to put my site > into maintenance via fabric. I would like to do something like; > > fab maintenance_on > > If this is not possible what are other common ways of remotely putting > a Django site into maintenance mode? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Satchmo, the bloated manatee
On Jul 28, 2011, at 4:26 PM, Russell Keith-Magee wrote: > > Yes, it really was. He opened a request for a subject line and first > sentence by comparing Satchmo to a fat, ungainly animal. That's isn't > a productive way to begin a request for help. Now let's not dis the manatee. Here's a manatee drinking from a garden hose video <http://youtu.be/h9ikUsiIPHA> I made in front of my parent's home. People should be respectful of manatees and open source developers. -- Eric Chamberlain, Founder RingFree Mobility Inc. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Tracking RSS feeds usage
Have you considered using feedburner? Google acquired them a few years ago. I think there is integration with Analytics. -- Eric Chamberlain, Founder RingFree Mobility Inc. On Aug 2, 2011, at 3:04 AM, Dealshelve Team wrote: > I am using > https://docs.djangoproject.com/en/dev/ref/contrib/syndication/#a-complex-example > for my project. > > Since the feed is essentially presented in XML to user, I have no way to > track the access with Google Analytics. > But I am thinking to register that access by sending Django request object to > Google Analytics when I call Feed's items() method. > > Has anyone done this before? Or does it even make sense? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: incrementing non primary keys.
If you are using a UUID for the primary key, do you really need an integer? We had a similar multi-tenant need and didn't want to leak usage information to the users, so we used UUID instead of auto incrementing integers. On Dec 15, 2010, at 9:23 AM, Hutch wrote: > Hi, > > I'm porting an old php app and have run into a bit of an issue. The > main problem is that we this app will need to be used by multiple > different companies. While I could just setup discreet instances, I'm > thinking that making the app multi-tenant would be a much wiser idea > and easier on resources, as traffic will be reasonably low, maybe > 100-200 users a day. I also don't desire to deal with 4 installations > of the code, when one will do. > > The specific problem I have though, is in the legacy app, the primary > key for a certain table is an auto incrementing integer. This needs be > kept separate for each tenant. What I'm planning on doing is making > the primary key a uuid, and using unique_together with an integer > field. However I could easily see a race condition with incrementing > the integer field. What is the best way to handle this situation? > > Also, what is the best way of filtering based on the site_id? should i > store a setting with the session and filter based on that? I was > thinking about seeing if it's possible to use a middleware to change > it at run time based on the request url. Is that a good idea? > > are there any documents on best practices for django multitenancy? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: incrementing non primary keys.
If you are using a UUID for the primary key, do you really need an integer? We had a similar multi-tenant need and didn't want to leak usage information to the users, so we used UUID instead of auto incrementing integers. On Dec 15, 2010, at 9:23 AM, Hutch wrote: > Hi, > > I'm porting an old php app and have run into a bit of an issue. The > main problem is that we this app will need to be used by multiple > different companies. While I could just setup discreet instances, I'm > thinking that making the app multi-tenant would be a much wiser idea > and easier on resources, as traffic will be reasonably low, maybe > 100-200 users a day. I also don't desire to deal with 4 installations > of the code, when one will do. > > The specific problem I have though, is in the legacy app, the primary > key for a certain table is an auto incrementing integer. This needs be > kept separate for each tenant. What I'm planning on doing is making > the primary key a uuid, and using unique_together with an integer > field. However I could easily see a race condition with incrementing > the integer field. What is the best way to handle this situation? > > Also, what is the best way of filtering based on the site_id? should i > store a setting with the session and filter based on that? I was > thinking about seeing if it's possible to use a middleware to change > it at run time based on the request url. Is that a good idea? > > are there any documents on best practices for django multitenancy? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: incrementing non primary keys.
If you are using a UUID for the primary key, do you really need an integer? We had a similar multi-tenant need and didn't want to leak usage information to the users, so we used UUID instead of auto incrementing integers. On Dec 15, 2010, at 9:23 AM, Hutch wrote: > Hi, > > I'm porting an old php app and have run into a bit of an issue. The > main problem is that we this app will need to be used by multiple > different companies. While I could just setup discreet instances, I'm > thinking that making the app multi-tenant would be a much wiser idea > and easier on resources, as traffic will be reasonably low, maybe > 100-200 users a day. I also don't desire to deal with 4 installations > of the code, when one will do. > > The specific problem I have though, is in the legacy app, the primary > key for a certain table is an auto incrementing integer. This needs be > kept separate for each tenant. What I'm planning on doing is making > the primary key a uuid, and using unique_together with an integer > field. However I could easily see a race condition with incrementing > the integer field. What is the best way to handle this situation? > > Also, what is the best way of filtering based on the site_id? should i > store a setting with the session and filter based on that? I was > thinking about seeing if it's possible to use a middleware to change > it at run time based on the request url. Is that a good idea? > > are there any documents on best practices for django multitenancy? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Can't use dumpdata and loaddata to migrate non-ASCII data between databases
Hi, We are trying to migrate between databases and we are running into a problem while trying to use dumpdata. We've tried: ./manage.py dumpdata --natural --indent 2 > dump.json and: ./manage.py dumpdata --natural --format xml --indent 2 > dump.xml Both return the following error: Error: Unable to serialize database: 'ascii' codec can't encode character u'\xe9' in position 18: ordinal not in range(128) Is there a way to dump and load non-ASCII data? -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Can't use dumpdata and loaddata to migrate non-ASCII data between databases
Or is there a better way to migrate a database from postgres to MySQL? On Jan 3, 2011, at 6:35 PM, Eric Chamberlain wrote: > Hi, > > We are trying to migrate between databases and we are running into a problem > while trying to use dumpdata. We've tried: > > ./manage.py dumpdata --natural --indent 2 > dump.json > > and: > > ./manage.py dumpdata --natural --format xml --indent 2 > dump.xml > > Both return the following error: > > Error: Unable to serialize database: 'ascii' codec can't encode > character u'\xe9' in position 18: ordinal not in range(128) > > Is there a way to dump and load non-ASCII data? > > > -- > Eric Chamberlain, Founder > RF.com - http://RF.com/ > > > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ContentType does not exist when trying to load auth with loaddata
Hi, We are trying to migrate databases and we are running into problems. We can dump the data: ./manage.py dumpdata --format=xml --natural --all --traceback auth > auth.xml But when we try and load it, we get an exception: ./manage.py loaddata --database=mysql auth.xmlInstalling xml fixture 'auth' from absolute path. Problem installing fixture 'auth.xml': Traceback (most recent call last): File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/core/management/commands/loaddata.py", line 167, in handle for obj in objects: File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/core/serializers/xml_serializer.py", line 158, in next return self._handle_object(node) File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/core/serializers/xml_serializer.py", line 198, in _handle_object data[field.attname] = self._handle_fk_field_node(field_node, field) File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/core/serializers/xml_serializer.py", line 222, in _handle_fk_field_node obj = field.rel.to._default_manager.db_manager(self.db).get_by_natural_key(*field_value) File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/contrib/contenttypes/models.py", line 15, in get_by_natural_key ct = self.get(app_label=app_label, model=model) File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/db/models/manager.py", line 132, in get return self.get_query_set().get(*args, **kwargs) File "/mnt/home/django/projects/rf/lib/python2.6/site-packages/django/db/models/query.py", line 341, in get % self.model._meta.object_name) DoesNotExist: ContentType matching query does not exist. How do we get around this error? Shouldn't syncdb create the ContentTypes? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: image servers?
You might want to look at django-storages <https://bitbucket.org/david/django-storages/wiki/Home>. We use it with S3. On Jan 10, 2011, at 4:55 PM, garagefan wrote: > so i bit the hype and got myself a rackspace cloud account. i also got > a rackspace file account for image serving. i would like to write > something that overrides where all images are saved, regardless of the > model that requests the save. > > what would this be? would i make this a middleware? I assume i need to > extend and "replace" the default "save file to MEDIA_ROOT directory" > > i havent had to extend or replace django's default behavior, so before > i start digging in to this, i need to know the best place for this... > which, i assume would be middleware. yes? > > thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem with django auth login_required and lighttpd
John, We have a similar configuration, try adding: FORCE_SCRIPT_NAME = '' to settings.py On Jan 11, 2011, at 2:44 PM, John Finlay wrote: > I'm trying to serve django pages using mod_fastcgi from a lighttpd server. > Everything works well using the setup recommended in the documentation except > for the initial login. The porblem seems to be that when the user tries: > > http://server/ > > the login page comes up with a url of: > > http://server/accounts/login/?next=/mysite.fcgi/ > > After the user login lighttpd returns a 404 looking for > http://server/mysite.fcgi/mysite.fcgi > > How do I fix this? A change in urls.py or a change in lighttpd.conf? > > Thanks > > john > -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Generate a unique username for django.contrib.auth
We use a base64 or base36 (if you want compatibility with the contrib.admin) encoded UUID, or generate a random 30-character string, the odds of a collision is quite low. On Jan 12, 2011, at 1:11 PM, Micah Carrick wrote: > I've got my site's authentication working with and email and password > only--no username (thanks to Shawn Milochik for helping me with that). > However, I still need to put in a username to make the User model happy. I > was hoping to have "user" as a prefix and then some unique number. > > I cannot simply copy the email to the username because the username must be > less than 30 characters and, after looking into my database, many email > addresses go over that. > I cannot generate a random number because there could be a collision. > I cannot use uuid4().hex because that's 32 characters... I need <30. > I cannot use User.objects.count() because that could result in a collision if > 2 users register at the same time. > > Thoughts? > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Generate a unique username for django.contrib.auth
Because the id is not known until after the record is saved, so you'd have to generate some non-colliding filler value anyway. Using incremental numbers can also leak usage information to the users. On Jan 12, 2011, at 1:52 PM, Acorn wrote: > Why not just use incremental numeric user IDs? > > On 12 January 2011 21:23, Eric Chamberlain wrote: >> We use a base64 or base36 (if you want compatibility with the contrib.admin) >> encoded UUID, or generate a random 30-character string, the odds of a >> collision is quite low. >> >> On Jan 12, 2011, at 1:11 PM, Micah Carrick wrote: >> >>> I've got my site's authentication working with and email and password >>> only--no username (thanks to Shawn Milochik for helping me with that). >>> However, I still need to put in a username to make the User model happy. I >>> was hoping to have "user" as a prefix and then some unique number. >>> >>> I cannot simply copy the email to the username because the username must be >>> less than 30 characters and, after looking into my database, many email >>> addresses go over that. >>> I cannot generate a random number because there could be a collision. >>> I cannot use uuid4().hex because that's 32 characters... I need <30. >>> I cannot use User.objects.count() because that could result in a collision >>> if 2 users register at the same time. >>> >>> Thoughts? >>> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django + CSS
Unless you are trying to serve your CSS inline, which it doesn't appear to be the case from your post, why wouldn't you serve your CSS files like any other static file? Serve the static file with your web server or CDN and put the url in the template, no magic required. On Jan 19, 2011, at 3:58 PM, brian.mus...@ff.com wrote: > Is it me or does it blow your mind that there is not one standard way > of importing something as common as CSS files into Django templates? > I realize there are a plethora of options as mentioned on the official > site here: http://docs.djangoproject.com/en/dev/howto/static-files/ > None of which actually ended up working for me and instead ended up > using this: > > urlpatterns in urls.py: > (r'^static/(?P.*)$', 'django.views.static.serve', > {'document_root': '/Users/home/djcode/mysite/media/ > css/','show_indexes' : True}), > > and then on my actual template page: > > > I suppose I was feeling a little misdirected by the default > settings.py in my projects folder where CSS and other Media are > supposed to be stored. > ADMIN_MEDIA_PREFIX = 'media/' That was not used at all in the > solution I ended up using which does work. > > My main complaint is this - for something so common as importing CSS > into django templates - why not just make it painfully obvious in the > documentation/djangobook with one golden way of doing so - why does > everything have to be so modular, etc? It starts to feel > counterproductive at a certain point - like why I am not just writing > this in python myself if there are going to be so many options. I > think django could use a little tightening up. I understand it's loose > coupling ways, etc - but don't use that as a shield for something > possibly unfinished? The solution I ended up using felt like a hack > for something so common. My two cents. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Looking for OAuth provider packages for django
Hi, We need to implement an OAuth provider in django. Are there any good packages already out there? -- Eric Chamberlain -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Looking for OAuth provider packages for django
If I hadn't searched Google yet, I would have probably asked if there are any packages, rather than asking if there are good ones that people would recommend. On Jan 21, 2011, at 12:27 PM, Shawn Milochik wrote: > Did you search Google yet? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ANN: Server upgrade on djangoproject.com
On Jan 31, 2011, at 9:15 AM, Shawn Milochik wrote: > > I was using my iPhone at the time. I probably should have checked it on a > desktop browser before replying to the thread. Sorry 'bout that. > On the iPhone, use two fingers to scroll to the cut-off text in the code box. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Storing *big* texts in db fields
Karen, In your use case, large text fields shouldn't be a problem. I would install the django-toolbar and use the reporting to determine if a particular query or template is causing the slowdown. Are you displaying the large text field in the admin list view? If you are and the view template is using a table, the browser won't display the table until all the data is rendered, that could be the cause of your slowness. On Jan 31, 2011, at 5:22 PM, Karen McNeil wrote: > I've created an application to manage texts, storing the content in a > TextField, along with metadata in other fields. Now that I've > completed the model and started actually adding the texts, the admin > is getting vey slow. The app is just for the use of me and my > team, so the slowness is not a deal-breaker, but it's annoying to work > with and I still have a lot of texts to add to the corpus. > > Although I may be adding a large amount of smaller texts in the > future, the texts that I have now are large, mostly in the tens of > thousands of words, with the largest currently at 101,399 words. > (Which I know because I added a method to the model to calculate the > wordcount, and have it displayed in the admin list. Which gives me no > end of pleasure.) > > So, is it a bad idea to be storing texts this large in a database > field? I really hope not, because when I first started this project > (granted, before I started using Django), I was reading the data from > files and running into constant encoding/decoding problems. (These > texts I'm collecting are in Arabic.) > > If it's not a totally horrible idea to do this like I'm doing, is > there anything I can do to improve performance? I tried implementing > caching and it didn't make any difference. > > Thanks, > Karen -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Debugging Why CSS File Will Not Load
Your port numbers don't match. What does Firebug or some other html debug tool say about the file? On Feb 2, 2011, at 10:55 AM, octopusgrabbus wrote: > I am trying to load static content (one css file) from the same apache > server, using a different virtual host. I have no errors, but the css > file appears not to load. How can I debug this further? > > The load shows up in /var/log/apache2/other_vhosts_access.log: > > Here are settings from httpd.conf. > > Listen 12345 > > > DocumentRoot /usr/local/www/documents/static > > > > I am loading the PageStyle.css file from a template. The css file is > in the static directory: > > Here is base.html that loads PageStyle.css > > >{% block title %}Town of Arlington Water Department AMR > System{% endblock %} > > > > > and the appropriate lines from settings.py > > > # URL that handles the media served from MEDIA_ROOT > MEDIA_URL = 'http://steamboy:8082' > > > PageStyle.css is set to display Windows Gray 0x808080. > > > > > other_vhosts_access.log > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Database synchronization with sometimes-connected mobile client
We had to work through similar issues with our iPhone and iPad applications. We wanted to decouple the server development from the iOS applications and decided to not try and mirror the device and server database schemas, we pass objects back and forth and let each implementation store the underlying object however it needs to (CoreData or SQL). Our object tracking is loosely based on Active Directory's multi-master replication model. We track objects by UUID and last modified timestamp. The device(s) can then pull/push all the moves/adds/changes since the last sync. On Feb 5, 2011, at 5:02 AM, Greg Humphreys wrote: > Hi everyone. I've developed a django website of medium complexity > (about 50,000 lines of python), and the company I work for is now > asking for a subset of the functionality to be available on an iPad. > > I'm familiar with iPad development, so I'm not worried about that, but > all the research I've done on keeping the databases synchronized has > basically boiled down to "it's hard, good luck" :) > > I want people to be able to make updates, deletes, and additions to > the database on an iPad, and then later synchronize these changes with > the web server (sort of like omnifocus), while also getting any new > changes that have been made on the server side. This is important > because the users won't always be connected to the internet. > > Every solution I've sketched out has my head spinning trying to figure > out how to handle foreign keys properly, what to do if the sync dies > partway through, and so forth. The server database will always be > considered sacrosanct, so if two people edit the same object, the > server version should always win (I'd just present the iPad user with > a list of things that he "lost" on). This includes situations like the > iPad user deleting an object that had been updated on the server since > the last sync, etc. > > Has anyone on this list ever tackled annoying like this? All my > django objects keep track of creation and modification time. I have > lots of foreign keys and many to many relationships. One very simple > thing that needs to happen just to get started would be that the > pre_delete signal would need to copy / flag entries so that deletions > could later be handled in synchronization. The iPad must keep deleted > objects (or at least their pks) around until the next sync, and the > server needs to keep the pks somewhere so it can tell remote clients > about the deletions later. And it just gets more complex from there! > > Another situation is if the iPad users creates a new object, and then > uses foreign keys to refer to it, the synchronization might change the > pk of the new object (since a new object with the same pk might have > been created on the server), so if that happens all those foreign keys > need to be fixed up on the iPad, and those implicit changes uploaded > to the server as well. Then if the app dies in the middle of that > process, it seems very very easy for one (or both!) of my quite large > databases to get in some inconsistent state that would be nearly > impossible to repair. > > One of the things I'd like to avoid is having to make every single > many to many relationship have to use a custom "through" class just > for synchronization, since that makes the admin interface less nice > without adding any real functionality to the web users. > > Am I screwed? Should I dust off my old silberschatz database book, or > is this easier than I think? -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Looking for IDE + FTP
On Feb 8, 2011, at 12:30 PM, Karen McNeil wrote: > I have three Django sites that I've been working on recently and I've > been doing most of the development work in Dreamweaver. I don't use > any of the wysiwyg features (or, pretty much, any of the Dreamweaver > program features), but I like it because I can do all the the code > edits and the FTP transfers all in one program. I like being able to > grab a remote file, make some code changes, save and upload all at > once, and view a nice graphical display of the file structure for the > local and remote sites. > > Problem is, Dreamweaver's code view is definitely not built for > Python, and it doesn't look like they have any plans to support it any > time in the foreseeable future. Which means that I get no color- > coding of the code, and I'm constantly getting indentation errors. > > I've always had Dreamweaver on my computer (a Mac) and so have never > used a separate FTP program, and the only IDE I've ever used is IDLE. > I used IDLE when I was first learning Python, but now that I'm working > with the websites, I find it much more convenient to just open the > files from within DW. Does anyone know of another, Python-friendly, > program that I could use for both code-editing and ftp? > I use BBEdit. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How should I properly impliment HTTP(S) auth (REMOTE_AUTH) in django?
I wouldn't consider using a UUID as multi-factor authentication. All our API traffic is over https. We use the basic authentication included with django-piston. Any reason why you want to exchange username and password for an API Key? Why not just authenticate each request with username and password? On Feb 8, 2011, at 5:37 PM, Sean W wrote: > This is a re-post of my stack overflow question here > http://stackoverflow.com/questions/4939908/how-should-i-properly-impliment-https-auth-remote-auth-in-django > > Hi, > > I am in the planning phase a new project. I want to be able to control > multiple relays from my android powered phone over the internet. I need to > use an HTTP based server as a middleman between the phone and the relays. > Django is my preferred platform because Python is my strongest skill set. > This would not be a "web app" (with the exception of the admin interface for > managing the user and their access to the relays). Rather, the server would > simply provide an API in the form of HTTPS requests and JSON encoding. > Though, I should note that I have never done any web development in my life, > so I don't know best practices (yet). The authentication method should meet > the following criteria: > > Works over HTTPS (self-signed SSL) > Provides multi-factor authentication (in the form of something you have and > something you know) > Be reasonably secure (Would be very difficult to fool, guess at. or otherwise > bypass) > Is simple in implementation for the server operator and end user on the > mobile client > Is lightweight in in terms of both CPU cycles and bandwidth > > I plan to use the following scheme to solve this: > > An administrator logs into the web interface, creates a user, and sets up > his/her permissions (including a username and a password chosen by the user). > The user starts the client, selects add server, and enters the server URL and > his/her credentials. > The client attempts to authenticate the the user via HTTP auth (over SSL). If > the authentication was successful, the server will generate an API key in the > form of a UUID and sends it to the client. The client will save this key and > use it in all API calls over HTTPS. HTTP auth is only used for the initial > authentication process prior to reviving a key, as a session scheme would not > be nessessary for this application. Right? The client will only work if the > phone is configured to automatically lock with a PIN or pattern after a short > timeout. The server will only allow one key to be generated per user, unless > an administrator resets the key. Hence, simple, mobile, multifactor > authentication. > Is this sound from a security standpoint? Also, can anyone point me to an > example of how to use the HTTP auth that is built into Django? From a Google > search, I can find a lot of snipits witch hack the feature together. But, > none of them implement HTTP auth in the wayit was added to Django in 1.1. The > official documentation for REMOTE_AUTH can be found here, but I am having > difficulty understanding the documentation as I am very new to Django. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: standalone server
We've used Twisted with the django ORM for similar uses in the past. On Feb 8, 2011, at 10:50 PM, rahul jain wrote: > Hi Guys, > > I would like to create a standalone server using django environment which > accepts/receive inputs through socket connections. After that some processing > and then updating the database. > > I created one python server and set the environment variable but I figured > out that as soon as something goes wrong, server crashes and then I have to > manually re-run the server. So was not reliable at all. > > Please if someone worked on these kind of issues before where you would like > to accept connections from outside not web request, but would like to receive > some data from outside through sockets then please let me know how to best > deal with it. > > thanks. > > Rahul -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django Mutlisite Setup
On Feb 13, 2011, at 7:08 PM, Jason Drane wrote: > Forgive me if this question offends you more advanced users. I am > begun down the road of learning Django. I am curious if it is possible > to place Django in the root of my server and reference it to each of > multiple sites in development, similar to php, python, etc. We run multiple sites on our servers, but we don't have them all share the django installation. We use virtualenv and each django project has its own environment. It makes it much easier to upgrade the projects when they are not all relying on the same installation. To simplify the web server configuration, we do have all the projects at the same django version level share the admin media. We serve that from Amazon S3. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: App engine serving static files?
On Feb 15, 2011, at 11:44 PM, Praveen Krishna R wrote: > Hey Guys, > > Does Anyone has experience, serving static content with google app engine? > Does it make a big difference, than serving it with nginx on the same server > as django? > I currently use a shared hosting, and was just thinking to move the static > content to GAE > I would like to know your thoughts on this We serve our static content from Amazon S3, it's much easier to setup and use. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Select x random rows from DB
On Feb 20, 2011, at 4:30 PM, Christophe Pettus wrote: > > On Feb 20, 2011, at 2:19 PM, galago wrote: > >> What is the best way, to select X random rows from DB? I know that method: >> .all().order_by('?')[:X] is not good idea. > > The best way is to push it onto the DB, using a raw query: > > random_results = Table.objects.raw("SELECT * FROM table ORDER BY > random() LIMIT X") If you have lots of rows, this query is really slow as the db must build a new table for the ORDER BY. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: mod_wsgi or mod_fcgi
On Feb 23, 2011, at 11:10 PM, Shamail Tayyab wrote: > Hi, > > I am going to deploy a site today on an Amazon's large instance. > Our setup is like this: > > server 1: mongoDB + redis server > server 2: django + nodejs > > We are using node for server push things. Can you please suggest what > would be the best way to deploy django as? (via wsgi or fcgi). We've > planned to use lighttpd (apache can also be used if required). > We've been using lighttpd with fastcgi for a few years without problems. I'd be interested in hearing more about what others like about nginx over lighttpd. We originally went with lighttpd, because that's what one of our developers knew how to configure. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django on EC2
On Mar 20, 2011, at 2:21 PM, ydjango wrote: > I need to install a nginx(optional), Linux, Apache, Django 1.2, > python2.6 env and Mysql on EC2 and ESB. > > Can you please point to any recent instructions on how to install on > amazon 2 and which images to use? > > How has your experience been so far? > We use the Amazon Linux AMI for our web/app servers and Amazon RDS for our database. -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.