Re: Best practices for serving images?

2013-06-21 Thread Some Developer
On 22/06/2013 03:33, Jacky Tian wrote: I've got an app that serves galleries of user-uploaded photos, some of which can be quite large in size. I've been serving scaled thumbnails for most templates, but I need a higher resolutions for a detail page. These images will still be smaller than the si

Best practices for serving images?

2013-06-21 Thread Jacky Tian
I've got an app that serves galleries of user-uploaded photos, some of which can be quite large in size. I've been serving scaled thumbnails for most templates, but I need a higher resolutions for a detail page. These images will still be smaller than the size of original image, and I'm wonderi

Re: TEMPLATE_CONTEXT_PROCESSORS missing in settings.py

2013-06-21 Thread asaxena
Thank you! I'm always amazed at how quickly and accurately people respond in this group--much appreciated. Alok On Friday, June 21, 2013 9:18:59 PM UTC-4, ayeowch wrote: > > TEMPLATE_CONTEXT_PROCESSORS is not there by default in your project's > settings.py. It's defined in the django/conf/glo

Re: TEMPLATE_CONTEXT_PROCESSORS missing in settings.py

2013-06-21 Thread Addy Yeow
TEMPLATE_CONTEXT_PROCESSORS is not there by default in your project's settings.py. It's defined in the django/conf/global_settings.py, see https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATE_CONTEXT_PROCESSORSfor the default callables that are included. On Sat, Jun 22, 2013 a

TEMPLATE_CONTEXT_PROCESSORS missing in settings.py

2013-06-21 Thread asaxena
Hey everyone, Currently a noob to Django--I'm using Django 1.5.1 installed with Python 2.7 in a virtualenv. I'm learning about context processors and noticed that TEMPLATE_CONTEXT_PROCESSORS is completely missing from my settings.py. Is this normal? Am I supposed to add Django's default templat

database error

2013-06-21 Thread Michael P. Soulier
Hi, I have a Django UI with a daemon running in the background, both using the Django models to update the postgres database. When the daemon in the background gets very busy, I'm getting errors in the UI while trying to load the page (simply reading the postgres db). DatabaseError at /clients/mi

CachedStaticFilesStorage with database cache backend - static file not found (404)

2013-06-21 Thread luke lukes
Hi everyone. I've enabled CachedStaticFileStorage . I'm using db as cache backend. I followed all the things said in the django docs, now my settings looks like this: # cache table settings

Re: How to divide my apps? Good practices?

2013-06-21 Thread Tim Chase
On 2013-06-21 09:29, galgal wrote: > But I can see now that there will be a massive amount of models. [snip] > I will have at least 15 models in it and I think it will > increase in some time Just as an aside, having worked developing a lot of business/"enterprise" applications, 15 models is a pre

Re: File Path Question

2013-06-21 Thread Jacky Tian
Have you set your MEDIA_ROOT appropriately in settings.py? Since fileview.py is where your original exception originated, can you post the relevant parts of the source in that file (whatever function line 5 belongs to). Did you get the exception under runserver or a "real" webserver? You should

Re: How to divide my apps? Good practices?

2013-06-21 Thread Christian Schmitt
That is fine in one app. just seperate them. delete models.py and make a package named models. import every model in the __init__.py file from models.py, make sure u set a class Meta: app_label = 'your app name' to every model and you have a very clean app structure. Am Freitag, 21. Juni 2013 1

Re: How to access request/session information from model.clean?

2013-06-21 Thread Jason Arnst-Goodrich
If you want to update the initially selected value (but still allow the user to select a different site)I think you're on the right track with ModelAdmin.get_form If you want to completely restrict them to their current session's site you'll want to use a combination of ModelAdmin.get_form (to

Re: File Path Question

2013-06-21 Thread Bill Freeman
On Fri, Jun 21, 2013 at 11:34 AM, Nigel Legg wrote: > In the path shown in my previous email, documents is a subdirectory of the > media directory, which is set in settings.py. > No it's not a subdirectory. It begins with '/', so it is sought at the root of the filesystem. > > >>> IOError at /

Re: Doubt the split()

2013-06-21 Thread Bill Freeman
import re hexnum = re.search(r': ?([0-9a-fA-F]+)>', the_string).group(1) It is worth you while to learn about regular expressions: http://docs.python.org/2.7/library/re.html There are ways to do this without regular expressions, and there are simpler patterns for this specific formatting, more f

Re: Doubt the split()

2013-06-21 Thread Gustavo Carneiro
But note that this question is completely off-topic for the django-users list. On Fri, Jun 21, 2013 at 5:47 PM, Tomas Neme wrote: > a regex? > > something like re.match("\[ yourstring).groups()[0] > > -- > You received this message because you are subscribed to the Google Groups > "Django users

Re: Doubt the split()

2013-06-21 Thread Tomas Neme
a regex? something like re.match("\[http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

Re: How to divide my apps? Good practices?

2013-06-21 Thread Tom Evans
On Fri, Jun 21, 2013 at 5:29 PM, galgal wrote: > In 1 app there will be a many many lines of code and after some time it will > be hard to develop I think. Sorry, I just wanted to reply to just this line as well! There is no problem with having apps with a lot of code. Each part of an app - mod

Re: How to divide my apps? Good practices?

2013-06-21 Thread Tom Evans
On Fri, Jun 21, 2013 at 5:29 PM, galgal wrote: > But I can see now that there will be a massive amount of models. Each player > should have his own statistics for each games, there will also be a part for > referees. Referee work will be rated by users so - many models is planned. If > I put it

Re: How to divide my apps? Good practices?

2013-06-21 Thread galgal
But I can see now that there will be a massive amount of models. Each player should have his own statistics for each games, there will also be a part for referees. Referee work will be rated by users so - many models is planned. If I put it in one app, I will have at least 15 models in it and I

Re: 'SafeText' object has no attribute 'status_code'

2013-06-21 Thread Bill Freeman
Try using render or render_to_response instead of render_to_string. A view needs to return and HttpResponse object, not a string. On Thu, Jun 20, 2013 at 4:59 PM, der_fenix wrote: > ** > > Hello I have problem with render_to_string > > django it's showme this error message : > > 'SafeText' obj

How to access request/session information from model.clean?

2013-06-21 Thread Richard E. Cooke
I'm trying to pass the request object, which includes the session object, to a chunk of Django 1.5 code that is tied to the model (model.clean). When running the Admin app, it does not have access to the request object. So I tried stashing it in RAM using thread.local(), only to get a crash co

Re: How to divide my apps? Good practices?

2013-06-21 Thread Christian Schmitt
You shouldn't divine things that should be together. Better make things together like, game, forum, blog. Don't make a app for too many things. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving em

Re: File Path Question

2013-06-21 Thread Jacky Tian
What does your project directory tree look like? I suspect the error has to do with where your documents/ directory is located in relation to the working directory. Try loading the document using a path relative to your project root. -Jacky Tian On Friday, June 21, 2013 9:29:20 AM UTC-4, Nige

Re: File Path Question

2013-06-21 Thread Nigel Legg
In the path shown in my previous email, documents is a subdirectory of the media directory, which is set in settings.py. views.py: from myproject.myapp.forms import DocumentForm def list(request): # Handle file upload if request.method == 'POST': form = DocumentForm(request.POST,

Mongoengine delete file gridfs

2013-06-21 Thread Hélio Miranda
I am using mongoengine to insert images in mongodb's GridFS. Insert everything is ok, but I now want to delete, and I'm not getting. I am using version 0.8.2 and I'm mongoengine to do so: class Animal(Document): genus = StringField() family = StringField() photo = FileField()

Re: How to divide my apps? Good practices?

2013-06-21 Thread galgal
@Mayukh Mukherjee yes, I have that in mind. That's why I'm asking about it:) I'm confused now and need any advice if that all models should be in 1 app, or in couple of apps. I'm rather convinced to make couple of apps - teams (models with teams - at least 2 models. team as global in my

Re: Project settings and application settings.

2013-06-21 Thread Tom Evans
On Fri, Jun 21, 2013 at 12:38 PM, wrote: > > I don't really want the settings to be adjusted at runtime, I would like my > application to reset some django "core" settings like the MIDDLEWARE_CLASSES > during the project configuration, once for all. > It is just to ease the deployment of the proj

Re: How to divide my apps? Good practices?

2013-06-21 Thread Mayukh Mukherjee
Just some generic advice -- keep each app focused on one individual task,as a rule of thumb you'd want maybe 5 +/- 2 models per app. Better to have multiple apps that each do one thing well than one large app that does everything. Best On Thu, Jun 20, 2013 at 5:01 PM, galgal wrote: > Hi, > I

File Path Question

2013-06-21 Thread Nigel Legg
New to Django(ish). I'm not sure whether my error is coding or OS related: I am getting the following error message: IOError at /myapp/file_view/4/ [Errno 2] No such file or directory: 'documents/2013/06/20/testdata1.csv' Request Method: GET Request URL: http://127.0.0.1:8000/myapp/file_view/

Re: get django with ftp

2013-06-21 Thread Sebastian Goll
On Fri, 21 Jun 2013 06:54:11 -0600 Larry Martell wrote: > Is there a ftp site I can download django 1.4 and 1.5 from? Usually I > get it from https://www.djangoproject.com/download/1.5.1/tarball/ > but now I have to install it on a remote machine that I only have > putty access to, so I can't run

Re: get django with ftp

2013-06-21 Thread Larry Martell
On Fri, Jun 21, 2013 at 6:58 AM, David Markey wrote: > No wget or curl command available? > > wget https://www.djangoproject.com/download/1.5.1/tarball/ -O django.tar.gz > > curl -L https://www.djangoproject.com/download/1.5.1/tarball/ > > django.tar.gz > Thanks! > On 21 June 2013 13:54, Larry

Re: get django with ftp

2013-06-21 Thread David Markey
No wget or curl command available? wget https://www.djangoproject.com/download/1.5.1/tarball/ -O django.tar.gz curl -L https://www.djangoproject.com/download/1.5.1/tarball/ > django.tar.gz On 21 June 2013 13:54, Larry Martell wrote: > Is there a ftp site I can download django 1.4 and 1.5 fro

get django with ftp

2013-06-21 Thread Larry Martell
Is there a ftp site I can download django 1.4 and 1.5 from? Usually I get it from https://www.djangoproject.com/download/1.5.1/tarball/ but now I have to install it on a remote machine that I only have putty access to, so I can't run a browser. -- You received this message because you are subscri

Re: Project settings and application settings.

2013-06-21 Thread Drew Ferguson
On Fri, 21 Jun 2013 04:38:33 -0700 (PDT) piir...@gmail.com wrote: > > I don't really want the settings to be adjusted at runtime, I would like > my application to reset some django "core" settings like the > MIDDLEWARE_CLASSES during the project configuration, once for all. > It is just to ease

Re: Project settings and application settings.

2013-06-21 Thread piir . dk
I don't really want the settings to be adjusted at runtime, I would like my application to reset some django "core" settings like the MIDDLEWARE_CLASSES during the project configuration, once for all. It is just to ease the deployment of the project and because the applications knows which sett

Doubt the split()

2013-06-21 Thread Hélio Miranda
Hi I do not know how to spit () Having this string [], how can I get just the number? Someone can help me? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to djan

Re: Restrict access to one device per user at any given time

2013-06-21 Thread Mark Robson
Hi, You should not prohibit the user from logging on, rather, you should "log out" their previous session when they start a new one (e.g. on a different device). You might want to notify the user when this happens, to enable them to detect if their account has been compromised (more easily). A

Re: Low Level Cache Issue

2013-06-21 Thread Max Vizard
Figured this out now. The problem is that Django automatically prepends ':1:' to the key, where 1 is the VERSION setting from the CACHES dict. I didn't think this was made particularly clear in the documentation when I first went through it but sure enough, it is quite clearly stated here: http

Restrict access to one device per user at any given time

2013-06-21 Thread mjh
Hi, I am trying to figure out the best way of restricting access to a given django project so that a single user can login as normal but then has to logout again if they want to access it from a different session. I am thinking just to set a flag in the userprofile table upon login and then re

Re: Installing/implementing a Python-based API on my website

2013-06-21 Thread Derek
CND Your question seems obscure - what exactly do you mean " implementing it on a site"? If you have Django up-and-running (and I assume you do, because why else would you be here?), then the specialised code you write can be added to a file (e.g. "mycode.py") and saved, for example, in the sa