django

Which side of the api chasm?

I am torn between to DRY and loose coupling :( I have two sites which you can link your account and then the sites can share data (via a RESTful api...) one site is a media aggregation site and the other is a media store where people can buy digital media (music/photo/video). My boss wants to emulate the itunes store and have a built-...

Pragmatically adding give-aways/freebies to an online store.

Our business currently has an online store and recently we've been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the extra free items to their order after they checkout. Of course, it'd be nice to automate this entire process. I've been mulling over a fe...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: <a href="{%url some_view%}?next={{request.get_full_path}} Here I am following a convention: if next features something that I'm not in cont...

Speeding Up the First Page Load in django

When I update the code on my website I (naturally) restart my apache instance so that the changes will take effect. Unfortunately the first page served by each apache instance is quite slow while it loads everything into RAM for the first time (5-7 sec for this particular site). Subsequent requests only take 0.5 - 1.5 seconds so I woul...

How do I make a Django Admin drop down list have a dependency on a search box?

I currently have a workable Django admin on the left mockup below but want it to look and function like the one on the right. Basically, I'm creating customized menu list every now and then but I have 1000 menu items to choose from. The pain is manually finding the item I want by scrolling through about 1000 items. I'm thinking of a...

Database trouble in Django: can't reset because of dependencies

I'm trying to reset a database in Django, using: python manage.py reset app but get the following error: Error: Error: app couldn't be reset. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the database tables doesn't exist. * The SQL was invalid. Hint: Look at the output of 'djan...

A "safe" python HTML text formatting (ala textile)

I've been looking around for an existing python library in the style of textile to format text for users to enter. If it was just me entering it, just textile would have been fine, but since the input is meant for a django app that will take user input and display it, while still maintaining some formatting. I managed to find little lo...

Python (and Django) best import practices

Out of the various ways to import code, are there some ways that are preferable to use, compared to others? This link http://effbot.org/zone/import-confusion.htm in short states that from foo.bar import MyClass is not the preferred way to import MyClass under normal circumstances or unless you know what you are doing. (Rather, a bette...

Can I use Django 1.1 with django-search-lucene for full-text searching, and if so, what resources/links/docs can I reference to get it up and running?

A little background: I want to use Django Search with Lucene I have Django 1.1 w/ Python 2.5 installed MySQL 5.1 is being used My local machine is running Windows Vista x64, but we will deploy to Red Hat Linux Yes, I wish that right about now I was running Linux. ...

Django - filtering on generic related objects

Given the following models adapted from http://www.djangoproject.com/documentation/models/generic%5Frelations/ class TaggedItem(models.Model): """A tag on an item.""" tag = models.SlugField() content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeig...

Django modify DATABASE_HOST at runtime

I am trying to switch between 2 mysql servers at runtime. I do not need to maintain both connections alive all the time. This is what I am doing from django.conf import settings from django.db import connection from django.contrib.auth.models import User connection.close() setattr(settings, 'DATABASE_HOST', 'mysql1.com') list1 = User....

How to find objects with a join in common?

Given a specific member (eg: John) how do I find all the Members that John shares a group with? class Member(Model): first_name = CharField(max_length=30) class GroupMember(Model): member = ForeignKey(Member) group = ForeignKey(Group) since = DateField() class Group(Model): name = CharField(max_length=30) ...

How might I handle development versions of Python packages without relying on SCM?

One issue that comes up during Pinax development is dealing with development versions of external apps. I am trying to come up with a solution that doesn't involve bringing in the version control systems. Reason being I'd rather not have to install all the possible version control systems on my system (or force that upon contributors) an...

django fastcgi nginx

i m using django with fastcgi + nginx.I want to know were the logs (error) are stored in this case ...

Playframework and Django

I have worked with Django before and have recently seen the Play framework. Is this the Java community's answer to Django? Any experiences with it? Any performance comparisons with other Java web frameworks? Edit:Almost similar to http://stackoverflow.com/questions/1597086/any-experience-with-play-java-web-development-framework, the re...

Understanding Zope internals, from Django eyes

Note: This is not a post regarding which is better, zope or django? Its about understanding zope internals/architecture, when compared to Django's I am a newbee to zope and I previously worked on Django for about 2.5 years. So when I first jumped into Zope(v2)(only because my new company is using it since 7 years), I faced these questio...

Uploading multiple files in Django through one form field

Is there any custom widget (or a special magic way) to upload multiple files (or a whole folder!) through one form field? I have tried this multifile widget but it uses many simple FileFileds. ...

setting up virtualenv for django development on windows,

Hi, Setting up a virtualenv for the first time, when i try to install MySQL-python using pip -E <<some virtual env>> install MySQL-python i get File "setup_windows.py", line 7, in get_config serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key']) WindowsError: [Error 2] The system cannot find the file ...

When Does Django Perform the Database Lookup?

From the following code: dvdList = Dvd.objects.filter(title = someDvdTitle)[:10] for dvd in dvdList: result = "Title: "+dvd.title+" @ "+dvd.price+"." When does Django do the lookup? Maybe it's just paranoia, but it seems if I comment out the for loop, it returns a lot quicker. Is the first line setting up a filter and then the fo...

django url scheme in apache and dev server

I have a a django application which is being served from apache/mod_wsgi under www.mysite.com/mysite suppose I redirect url "myapp" -> myapp/urls.py so to visit it from apache I will visit www.mysite.com/mysite/myapp/page1 to visit it from dev server I will need to visit www.mysite.com/myapp/page1 it also means absolute URLs wil be di...