Django with Cherokee web server

2009-10-06 Thread hcarvalhoalves
I recently found this web server (http://www.cherokee-project.com/) that claims to be "the fastest web server". I'm not sure that holds true for *CGI, but at least for static content they have some impressive benchmarks. Despite the claimings, it's an interesting alternative for what it supports o

Re: One to Many on Template UI

2009-10-06 Thread hcarvalhoalves
On 7 out, 01:23, robinne wrote: > I have my model setup with foreign key relationships. I can read one > table's data to the UI. But I cannot figure out how to read child > records onto template. I know it is (in the case of Blog, Author, and > Entry) b.entry_set.all(). But I don't know where thi

Re: Django with Cherokee web server

2009-10-07 Thread hcarvalhoalves
ic content). Instead, I'm looking for advice from someone who already deployed Django with Cherokee. On Oct 7, 2:41 am, Graham Dumpleton wrote: > On Oct 7, 3:34 pm, hcarvalhoalves wrote: > > > > > I recently found this web server (http://www.cherokee-project.com/) > > th

Re: Django SAAS projects

2009-10-19 Thread hcarvalhoalves
On Oct 16, 7:09 pm, Savy wrote: > Hi Djangonauts, > > I am developing  a Django project (with a few pluggable apps). > > I want to offer this project as a SaaS (something like 37signals.com). > > i.e: customer1.product1.com , customer2.product2.com etc > > product1 could be the basecamp product2

Re: Versionable Models?

2009-10-28 Thread hcarvalhoalves
On Oct 27, 4:54 pm, Todd Blanchard wrote: > Total django noob here.  Rails/PHP/WebObjects refugee here. > > I'm starting a project where some models need to be fully versioned. > > IOW, record update is forbidden - every save to a changed model should   > result in a new record with a new version

Re: Where are forms usually defined?

2009-11-04 Thread hcarvalhoalves
The common convention seen on Django code and 3rd party apps is to have a forms.py inside the app dir. But It doesn't matter because Django doesn't enforce a particular file name for this, you're free to organize your code tree as you like. Keep in mind that Django is just Python, so if you're ne

Django + Cherokee Web Server

2009-11-26 Thread hcarvalhoalves
I'm able to configure Cherokee to run my Django project correctly, using the included wizard. The problem is, if an exception is thrown, Cherokee just shows a "Unhandled Exception" page. I figured out that if I run fcgi with debug=true, then I get a stacktrace from Flup, but I wanted the default Dj

Re: Django + Cherokee Web Server

2009-11-27 Thread hcarvalhoalves
On Nov 27, 5:56 am, Jarek Zgoda wrote: > Wiadomo¶æ napisana w dniu 2009-11-27, o godz. 00:31, przez   > hcarvalhoalves: > > > I'm able to configure Cherokee to run my Django project correctly, > > using the included wizard. The problem is, if an exception is thrown,

Re: Giving up PHP. ...Can't decide between Django & Rails

2010-04-16 Thread hcarvalhoalves
Why do you have to "make a choice"? Learn both. They can be useful in many different ways. I learned Rails (and Ruby) before Django, because I saw some material for Ruby that got me interested in hacking on it. Some time later, Rails got really popular. Then lately I learned Python and Django, and

Re: MultiPartParserError HTTP_CONTENT_LENGTH zero when uploading a file

2010-08-03 Thread hcarvalhoalves
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, r

Re: MultiPartParserError HTTP_CONTENT_LENGTH zero when uploading a file

2010-08-10 Thread hcarvalhoalves
'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

Re: Best practice for maintaining the "Django stack"

2010-08-13 Thread hcarvalhoalves
This is a common issue with South: it sometimes swallows some import errors from other apps. In my case, I get this error with ImageKit when PIL is not installed, or not compiled correctly. About managing Django stack: the best thing you have is virtualenv + virtualenvwrapper and PIP with requirem

Re: Long running process and time outs?

2010-08-16 Thread hcarvalhoalves
Or you can just run the long running task on a separate thread. def my_long_running_function(): ... t = threading.Thread(target=my_long_running_function) t.setDaemon(True) t.start() Then make a view that has access to the result calculated on this thread, and shows the re

Re: How does Django handle auto-increment PK when a model is sharded horizontally into multiple databases?

2010-08-19 Thread hcarvalhoalves
On 19 ago, 22:03, Russell Keith-Magee wrote: > The instance will exist, but the author_id won't. Unless you are > manually allocating the primary key, the primary key is allocated by > the database at the time of object save, which means you won't be able > to determine the primary key until *afte

Re: What's the best practice for initializing the state of the server?

2010-08-19 Thread hcarvalhoalves
If it's loading data on model's tables, you can use fixtures: http://docs.djangoproject.com/en/dev/howto/initial-data/ Because it's also possible to define SQL files to run on syncdb, you can also run SQL-specific tasks (like defining functions, full text search indexes, etc...). If the your oth

Re: streaming out to a client using wsgi

2010-08-19 Thread hcarvalhoalves
Check this post: http://metalinguist.wordpress.com/2008/02/12/django-file-and-stream-serving-performance-gotcha/ On 19 ago, 15:27, "Henrik Genssen" wrote: > Hi, > > I read in the wsgi docs, that it is possible to stream data to a client e.g. > from a file stream like a pdf. > Can someone point

Re: Ability to use PSP templates with Django?

2010-08-21 Thread hcarvalhoalves
There are 2 approaches: - Think data structures instead, and put all this logic on your view, such that the template just needs to iterate thru one variable to build the menu. Something like passing in the template context: menu = [{'name': 'django', 'text': 'Official Django Site', 'url': 'http:/

Re: Any Django/Python Chat application ??

2010-09-10 Thread hcarvalhoalves
Best thing for chat (or any push applications) is to use something like Hookbox [1] They have an example chat application, check it out. [1] http://hookbox.org/ On Sep 10, 8:26 am, ravi krishna wrote: > Hi, > > Can somebody tell me some django Chat application which can be used to embed > insid

Re: Django 1.3 alpha 1 released

2010-11-11 Thread hcarvalhoalves
What about having an official 1.3 feedback thread at django-developers list? ;) I'm liking the pack of small improvements coming in this release, and timing is very good, well done. I must say I'm less than happy with the view classes though. Is the API on it frozen already? On 11 nov, 05:34, Jam

Re: Django 1.3 alpha 1 released

2010-11-11 Thread hcarvalhoalves
hy that views should just trust URL pattern matching? On 11 nov, 22:30, Łukasz Rekucki wrote: > On 12 November 2010 01:16, hcarvalhoalves wrote: > > > What about having an official 1.3 feedback thread at django-developers > > list? ;) > > > I'm liking the pack of sma

Re: Django 1.3 alpha 1 released

2010-11-12 Thread hcarvalhoalves
On 12 nov, 00:06, Russell Keith-Magee wrote: > On Fri, Nov 12, 2010 at 9:09 AM, hcarvalhoalves > > > > > > wrote: > > To be fair, I only had one small pet peeve with the current views API > > after trying the alpha: the use of self.args / self.kwargs. > >

Re: Storing API Passwords

2010-03-02 Thread hcarvalhoalves
If I'm not wrong, you *should not* be storing the user's password on your database. All you need to store is the API key, and it's useless if stolen because most webservices generate the key to match your host/ domain. The process to get an API key is, generally, 1-2-3, so you just pass around req

Re: Storing API Passwords

2010-03-02 Thread hcarvalhoalves
Sorry, I just saw Twitpic's documentation now [1]. What I can say, is that their implementation is a joke. Twitter is already supporting 3rd party apps authorization the proper way, there's no reason for Twitpic to ask user's passwords. While their implementation is wrong and they need to fix it,

Re: Storing API Passwords

2010-03-02 Thread hcarvalhoalves
On 2 mar, 14:40, Dougal Matthews wrote: > On 2 March 2010 14:11, hcarvalhoalves wrote: > > > Sorry, I just saw Twitpic's documentation now [1]. > > > What I can say, is that their implementation is a joke. > > It's not that simple. Twitpic is usually used b

Re: site management - maintanance mode

2010-03-13 Thread hcarvalhoalves
You can solve this with the server more easily than with the django app itself. I use the Cherokee webserver, and switching to maintenance mode is easy with it. Also, no need to cold-restart (your clients don't get a connection interruption). See how it works here: http://www.cherokee-project.com/

Re: File validation process

2010-03-13 Thread hcarvalhoalves
You could avoid the Javascript check (file extensions are just a convention, rarely thrustable) and just check the uploaded file mimetype on form validation code. `import mimetypes` for more. There's no clean way to interrupt file upload, though. On Mar 12, 11:27 pm, Vincent wrote: > I would li

Re: passing more information with formsets

2010-03-18 Thread hcarvalhoalves
On Mar 17, 9:34 pm, Alastair Campbell wrote: > On Wed, Mar 17, 2010 at 7:02 PM, Dennis Kaarsemaker > > wrote: > > In the view function, you could add an attribute (say, instance :-)) to > > each form in the formset. That to me is a better way than doing weird > > magic in a template. > > You're