Re: Why doesn't syncdb ever modify or drop tables anymore?
syncdb has never been able to modify existing models. In order to get some functionality like that, look into django-evolution: http://code.google.com/p/django-evolution/ -Chris On Thu, Dec 25, 2008 at 1:11 AM, Fluoborate wrote: > > Running the command: > python manage.py syncdb > Used to add tables and modify tables if necessary. I don't remember if > it ever dropped tables. It was great, I would modify models.py and > syncdb and it would just work. Then something changed, and I don't > know why. > > Now, syncdb never modifies or drops tables. It can still add tables. > This is very annoying. What's worse, this command: > python manage.py sqlclear appname > Doesn't do anything at all. > > What is going wrong? Has anyone else seen this? > > Thank you. > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Simple ManyToManyField/Model question
I am trying to make an application for recipes using Django. I am starting simple and going from the tutorial but not getting the results I want. In a less strict framework I'd be able to represent what I want to easily but I'm having trouble figuring out how to do it the Django way while keeping the database clean and easy to query to prevent performance issues. For this example, let's say I have two different models. Recipe, and Ingredient. A recipe has a name and a set of ingredients and an amount and measurement corresponding to each ingredient. An ingredient has only a name. Here's an example schema of what the database in my mind would look like in 3NF: create table drinks (id int(11) auto_increment, name varchar(255)); create table ingredients (id int(11) auto_increment, name varchar(255)); create table drinks_ingredients (drinks_id int(11) not null, ingredients_id int(11) not null, amount int(11) not null, unit varchar(12)); or similar. That allows me to create only one row per a specific ingredient in the ingredients table(e.g. salt) and then use any measurement of it in the drinks_ingredients table. That way you can easily search for recipes containing a specific ingredient. I'm having trouble figuring out how to get Django to recreate this database structure. The tutorial example with the poll application is similar but I'm not happy with the database schema because you can't use the same choice in multiple polls. This means that if you had 50 yes/no polls, you'd have "Yes" and "No" replicated in the database 50 times which, frankly, sucks. I think I need to use a ManyToManyField for this but I'm having trouble finagling it to be the way I want. Here's what I have right now but I can't figure out where to put the amount and unit for the ingredients: class Ingredient(models.Model): name= models.CharField(max_length=255) amount = models.IntegerField() unit = models.CharField(max_length=12) def __unicode__(self): return self.name class Admin: pass class Recipe(models.Model): name= models.CharField(max_length=255) ingredients = models.ManyToManyField('Ingredient') def __unicode__(self): return self.name class Admin: pass Any ideas would be greatly appreciated :) --~--~-~--~~~---~--~~ 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: Simple ManyToManyField/Model question
Perfect, the "extra fields" and an intermediary relationship model were exactly what I needed. Thanks. On Thu, Dec 25, 2008 at 3:14 PM, Ramiro Morales wrote: > > On Thu, Dec 25, 2008 at 5:13 PM, Chris Czub wrote: >> >> >> I think I need to use a ManyToManyField for this but I'm having >> trouble finagling it to be the way I want. Here's what I have right >> now but I can't figure out where to put the amount and unit for the >> ingredients: >> >> class Ingredient(models.Model): >>name= models.CharField(max_length=255) >>amount = models.IntegerField() >>unit = models.CharField(max_length=12) >> >>def __unicode__(self): >>return self.name >>class Admin: >>pass >> >> class Recipe(models.Model): >>name= models.CharField(max_length=255) >>ingredients = models.ManyToManyField('Ingredient') >> >>def __unicode__(self): >>return self.name >>class Admin: >>pass >> >> >> Any ideas would be greatly appreciated :) > > Take a look at the relevant documentation: > > http://docs.djangoproject.com/en/dev/topics/db/models/#many-to-many-relationships > http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships > > also, the m2m_through m2m_intermediary and m2m_through example: > > http://www.djangoproject.com/documentation/models/m2m_intermediary/ > > (tests/modeltests/m2m_intermediary/models.py in the Django source tree.) > and the m2m_through example (tests/modeltests/m2m_through/models.py in > the Django source tree.) > > HTH > > -- > Ramiro Morales > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Get old value of Field in ModelForm clean_* method?
Is there any way to get the old value of a field in a clean_* method on the ModelForm? That is - the validation depends on the old value of the field versus the new value. self.cleaned_data only contains the new value. Thanks, Chris --~--~-~--~~~---~--~~ 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: Get old value of Field in ModelForm clean_* method?
No, that is the uncleaned data. Maybe a more explicit example will help: You go to edit an instance of a model that has a field named "title". The value of "title" for this particular instance is currently "Test". You change the value of "title" from "Test" to "Test123" and click "save". How can I get the original value of "title"(that is - "Test", not the new value, "Test123") in the clean_title method? On Thu, Feb 12, 2009 at 6:27 PM, Briel wrote: > > Your problem is a bit unclear, but i think what you are looking for is > in self.data in your clean_ method > > On 12 Feb., 23:56, Chris Czub wrote: >> Is there any way to get the old value of a field in a clean_* method >> on the ModelForm? >> >> That is - the validation depends on the old value of the field versus >> the new value. >> >> self.cleaned_data only contains the new value. >> >> Thanks, >> >> Chris > > > --~--~-~--~~~---~--~~ 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_authenticated
If you are using default Django sessions, they will be stored in the database. >From the docs: By default, Django stores sessions in your database (using the model django.contrib.sessions.models.Session). Though this is convenient, in some setups it's faster to store session data elsewhere, so Django can be configured to store session data on your filesystem or in your cache. >>> from django.contrib.sessions.models import Session >>> Session.objects.all() [, , , , , , , , , , , , , , , , , , , , '...(remaining elements truncated)...'] >>> Session.objects.all()[0].get_decoded() {'_auth_user_id': 1L, '_auth_user_backend': 'django.contrib.auth.backends.ModelBackend'} On Sat, Feb 21, 2009 at 12:27 PM, Tim wrote: > > Hi - > > I am using the Django auth backend and I'd like to test which users > are currently logged in. I can't do this just by grabbing > User.objects.all() and testing each with is_authenticated, because the > User objects being User objects as opposed to AnonymousUser objects > will always return True for is_authenticated. Can anyone point me to > the right way to do this? > > - Tim > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Model-specific admin templatetag template OR admin list multi-sort
I am trying to customize the list view of one of my models in the admin to separate it into a few different tables for organization purposes. My model is an "order". The important fields for this problem are the user who placed the order, the date is was placed, the restaurant it was for, and the item at that restaurant they ordered. I have the date filtering set up with date_hierarchy so that's all okay, but what people would really like to be able to do is sort by restaurant THEN by items within that restaurant. Is that possible with the current admin? If not, what I'd like to do is break this out into a series of different tables, one for each restaurant. Then you'd be able to sort by item within those tables. I looked at: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates which says you can override admin templates on a per model basis, and I was able to do so for my change_list.html template, however I can't do it for the change_list_results.html template which is referenced by the results_list templatetag and handles the actual table output. In order to accomplish this, would I need to define a new custom templatetag and call it from the custom change_list.html template? Is there an easier way to do what I want? --~--~-~--~~~---~--~~ 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: Media Root & Templates
if you include the django.core.context_processors.media context processor http://docs.djangoproject.com/en/dev/ref/templates/api/?from=olddocs#django-core-context-processors-media On Thu, Feb 26, 2009 at 8:04 PM, AKK wrote: > > Hi, > > I have a template and I want to get some images out of my media root. > I was wondering is there anyway to automatically return the media root > from settings.py rather than manually specifying it rather each time. > > Thanks > > Andrew > > > --~--~-~--~~~---~--~~ 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: Filter ALL requests before dispatching via URLs.py?
What you are describing are Django "Context Processors". http://docs.djangoproject.com/en/dev/ref/templates/api/?from=olddocs#id1 Basically you'd make a new context processor to set the variables you need in your context and have it included for all of your views. You can do this on an application-specific level thusly: http://www.pointy-stick.com/blog/2008/02/12/django-tip-application-level-context-processors/ (there are a few typos in that article, I can reply with corrections if need be but I don't have them readily available) -Chris On Tue, Mar 10, 2009 at 11:18 PM, Joshua K wrote: > > Hello, > > Is there a way to filter all requests before URLS.py dispatches the > request? > > I am developing a Pinax application. I have some custom menu tabs > across the top, and I limit the visibility of those tabs depending on > flags present in the user's account. I do this by enabling custom > fields in the rendered context; the template contains a series of 'if' > statements to enable the correct tabs. > > On my custom tabs, the URLS of which dispatch to my custom views, > everything works because I set the proper variables in the context. > However, for other Pinax-basic stuff, those routines do not contain > code to set the variables in the context - so the tabs never show. > > How might I go about writing code that handles ALL requests, adding > the required variables, and then dispatches to URLS.py? > > Cheers, > -Josh > > > --~--~-~--~~~---~--~~ 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 ORM - Table Changes
That is a short-coming of the Django ORM, unfortunately solving the problem of iterative schema changes is pretty difficult. There are some projects around that attempt to fix this issue, in varying stages of completion: http://south.aeracode.org/wiki/Alternatives is a decent list. As for your specific question of changing the column name - eep :) It's slightly tedious to do that sort of thing seamlessly with the stock ORM. Here's the workflow I'd suggest for changing a column name: 1) Manually create a column named after what you want the new name to be, with the same data type, following the Django ORM's naming scheme 2) Copy the data from the old column for all rows into the newly created column 3) Update the code and change the property name in the model code 4) Ensure the application seems to be working 5) Drop the old-named column Note: These instructions may not apply directly, depending on what your property is - in the case of a many-to-many relationship, for example, a join table is used. I'm sure you can figure out how to go from here, though. -Chris On Thu, Sep 10, 2009 at 1:31 PM, Thomas wrote: > > I've been teaching myself Django over the past couple of days. Thus > far, everything has been going smoothly, as I typically do a lot of > non-web based Python coding, so am familiar with the language. > However, Django's DB API is my first look into ORM and how it works. > > I understand the basics; how to create models and run a syncdb to > generate tables. I understand how to query, update/insert, etc. the > data by instantiating the class model and using the API methods > against it. All nice and well. > > Where I get lost fast is when I need to make changes to a table. For > example, say I want to change the name of a column from 'foo' to > 'bar'. I can run an ALTER TABLE in SQL and do this easily, but I > thought the idea of ORM was that you weren't supposed to be using SQL > directly. I.e. is there a way to change a column name (or a table > name, or a attribute type, etc.) from within ORM, i.e. from within the > model class; or do I have to run the SQL, then change the model to > 'match' that SQL, and then run a syncdb. > > I love the concept of being able to access data through objects, but > am just confused as what 'workflow' I should be following when doing > something like changing a column name. > > Sorry for the basic question. Google hasn't been much help when > getting into these details. I can sort of 'figure it out' by running > the SQL, matching the model class and going from there... but wasn't > sure if that was the best, or only way. > > Thanks, > Thomas > > > > --~--~-~--~~~---~--~~ 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: Obfuscate HTML..?
What reason do you have for this? Security through obfuscation isn't a good strategy, especially with something as intrinsically open as HTML. If your site can be hacked just by being able to view the HTML then you have bigger problems to worry about than obfuscating it. On Mon, May 25, 2009 at 4:36 AM, Andy Mikhailenko wrote: > > Built-in template tag {% spaceless %) can do a part of work for you > (namely, remove the extra whitespace), but to actually obfuscate the > code you should either use middleware or make extensive use of > JavaScript (e.g. open GMail and try to read the source). However, the > idea in general sounds strange: most (or some) browsers let the user > view even JS-generated HTML, nicely formatted and perfectly > inspectable. David is right, this is probably not what you need. I > hate to mention Flash but it can be an option. > > On May 25, 7:40 am, jago wrote: >> Hi, >> >> I want to make the HTML of the website as little human readable as >> possible. For that I would like to add some layer to Django 0.96 which >> when writing out the page takes the HTML and adds some processing. >> >> 1. How would I obfuscate the HTML as much as possible (remove all line >> breaks, etc.) >> 2. How would I best add the layer which does this obfuscation > > > --~--~-~--~~~---~--~~ 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: newbie problem -- cant import library
Are you running that command from the interactive shell invoked by running 'python manage.py shell'? Invoking the interactive shell that way should set up all your python library settings properly for your Django app. On Apr 30, 2010, at 5:44 PM, Mark Serva wrote: I am running django 1.1.1 under ubuntu, and am going through jeff forcier's book on django development. I have a new project called mysite, which contains an app called blog. The problem I am having is getting the shell to recognize mysite. I would like to query my database and follow the examples in the book, but when I try to enter: from mysite.blog.models import BlogPost the shell gives me the following error: Traceback (most recent call last): File "", line 1, in from mysite.blog import BlogPost ImportError: No module named mysite.blog It seems like there is something wrong with the configuration, but I cant pin down what it is. Many thanks for any help. Mark -- 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: newbie problem -- cant import library
Oh... Actually looking at the error that was spit out, it looks like you made a typo. Your error says you typed 'from mysite.blog import BlogPost'. On Apr 30, 2010, at 5:44 PM, Mark Serva wrote: from mysite.blog import BlogPost -- 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: [Offtopic] Design introduction
Much like programming, it will come from experience. Practice a lot. You'll make a lot of things you aren't happy with, probably like your first bits of code :) Try to imitate things you like, and see the techniques they use to create cool designs. It, like anything else worth doing, will be easier with experience. The best way is to just do. See if you have any artistic friends that can give feedback on what you're creating. Try to identify what colors work well together(a site like colourlovers.com is nice for finding color schemes) and work with those. On Thu, Jul 8, 2010 at 10:27 AM, Matias wrote: > Sorry for this completely offtopic question. > > I'm a systems administrator with programming experience (mostly python and > C) and I love web applications design/programming and I'm pretty good with > html, javascript, css, etc... but I have a really weak point when it comes > to "images" desing. I mean, I'd love to learn how to do images like this: > http://www.freecsstemplates.org/previews/solutions/images/img01.gif > > (from the template http://www.freecsstemplates.org/preview/solutions/) > > I understand the basics, and I use quite frequently Gimp, but this is not > like coding, when you code, most of the times it is easy to understand what > is happenning (except if the code you are reading is perl :-P ) and thus, > you can learn but I still can't "read" images I see out there, so, I > guess there should be any learning path for this also or maybe is that just > the creative half of my brain is missing. > > Would you recommend any book? any website? or some other way to learn to do > "nice 3d looking menus, buttons"..etc? > > Thanks for your help, and sorry for the offtopic, but I didn't find a > better place to ask this. (didn't look for a lot also...) > > > 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: Table with 4 Milions of rows
It really depends on how you're selecting the data from the database. If you're doing something that necessitates a full table scan(like in-DB ORDER BY) it will slow you down considerably. If you're selecting one row from the database by an indexed column, then the performance will be very fast and there's no need to prematurely optimize. On Tue, Jan 12, 2010 at 2:25 PM, nameless wrote: > My table with 4 milions of rows is queried often by ajax. > So I think a performance problems ( I am using also index ). > Ok now take a look at the contenttypes :) > > > > > On Jan 12, 8:15 pm, Tim wrote: > > As far as needing to split up the table into other tables, I'm not > > sure. Whats wrong with having 4 million records in one table? > > > > But if you're going to do it, take a look at the contenttypes > > framework and generic relations. It basically does what you're > > describing: > > > > http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 > > -- > 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: Table with 4 Milions of rows
What might be useful is to figure out exactly what SQL Django winds up running then doing an "EXPLAIN " on that query in your DBMS from the command line. That will let you know what the backend is doing and what the performance considerations you should take are. On Tue, Jan 12, 2010 at 3:20 PM, nameless wrote: > The table is queried from ajax using an autocomplete field with this > query in the views.py: > > books.objects.filter(book_title__istartswith=request.GET['q'])[:100] > > > > > --- > > On Jan 12, 8:47 pm, Chris Czub wrote: > > It really depends on how you're selecting the data from the database. If > > you're doing something that necessitates a full table scan(like in-DB > ORDER > > BY) it will slow you down considerably. If you're selecting one row from > the > > database by an indexed column, then the performance will be very fast and > > there's no need to prematurely optimize. > > > > On Tue, Jan 12, 2010 at 2:25 PM, nameless wrote: > > > My table with 4 milions of rows is queried often by ajax. > > > So I think a performance problems ( I am using also index ). > > > Ok now take a look at the contenttypes :) > > > > > > > > > > On Jan 12, 8:15 pm, Tim wrote: > > > > As far as needing to split up the table into other tables, I'm not > > > > sure. Whats wrong with having 4 million records in one table? > > > > > > But if you're going to do it, take a look at the contenttypes > > > > framework and generic relations. It basically does what you're > > > > describing: > > > > > >http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1 > > > > > -- > > > 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. > > > > -- 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: wsgi - apache/nginx - why use nginx?
>1. my apache server on port 80 serves both a normal site (php) and the >django files. i would like to keep my normal site on port 80. is there >a way to keep it that way? as far as i understand the two servers must >be running on different ports. Look into what is called a "reverse proxy" e.g. Squid. You can route requests based on path to different app servers. On Wed, Jan 20, 2010 at 12:25 PM, Itay Donenhirsch wrote: > thanks for the detailed and concise reply! > i have two more question though: > 1. my apache server on port 80 serves both a normal site (php) and the > django files. i would like to keep my normal site on port 80. is there > a way to keep it that way? as far as i understand the two servers must > be running on different ports. > 2. is there any effect of the apache-does-all on the system except > performance? > thanks > itay > > On Wed, Jan 20, 2010 at 5:40 PM, Javier Guerra wrote: > > On Wed, Jan 20, 2010 at 10:24 AM, Itay Donenhirsch > wrote: > >> the question is - why use nginx at all? why not let apache serve the > >> static files as well? what's escaping me? > > > > the mod_python module runs Django (or any python code) in the same > > process than the rest of apache. that means that any apache thread > > would do both static files _and_ Djando apps, therefore any internal > > caching done by Apache impacts negatively on the python space, and > > viceversa. It's better to have some threads dedicated to static > > files, and others to app processing. using any out-of-sever-space > > strategy (two webservers, FastCGI, mod_wsgi in daemon mode, etc) > > achieves that. > > > > -- > > Javier > > > > -- > > 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. > > > > -- 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.
Genericized pre/post-request processing in Controller?(View?)
Here's a question that is probably divisive - why did Django decide to go with Model/Template/View instead of Model/View/Controller? MVC just conceptually makes so much more sense to me. Anyhow, that's not the primary point of this posting... Is there any way to implement some sort of pre and/or post-request processing that runs across any request that comes through? Does this already exist? Ideally I would use this to implement some sort of RESTful interface(yes, I know about the Django REST interface http://code.google.com/p/django-rest-interface/ but I don't like that it seems to violate DRY by requiring you to write extremely similar code for each of your models - and the fact that you have to define one url per view type per model. If you had four view types (XML, JSON, HTML, plaintext) and five models, things get messy and hard to maintain quick!) Either way, I am wondering if there is some sort of start/end method similar to what other frameworks provide? At least in perl Catalyst I know that you can define a global start and end method that are wrapped around any request. I would use these methods to start developing my idea for a genericized RESTful API that you can easily add any model to. Thanks, Pythonistas! --~--~-~--~~~---~--~~ 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: OT: Django logo
Yes, I am 95% sure the line below is Verdana - note the shape of the a, o, and d. On Tue, Mar 25, 2008 at 10:01 PM, Ned Batchelder <[EMAIL PROTECTED]> wrote: > The "perfectionists with deadlines" tagline is also in Prokyon, but a > different weight (regular or light). The line below that on the home page > ("Django makes it easier..") is not Prokyon (the j and g are different), > maybe Verdana? Not sure why the white text and the green text would be in > different faces, but there you are. > > --Ned > http://nedbatchelder.com/blog > > Alvaro Mouriño wrote: > > On Tue, Mar 25, 2008 at 10:02 PM, Justin Lilly <[EMAIL PROTECTED]> <[EMAIL > PROTECTED]> wrote: > > > whatthefont.com couldn't find a good match. > > > > I didn't know that site. I checked and matched 5 fonts, but none of > them was exactly it, but still does a great job recognizing the > letters! > > > > -- > Ned Batchelder, http://nedbatchelder.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: Distributed databases
Would it be possible to replace the Django database driver(i.e. postgresql, sqlite, mysql) with a custom one that managed the various database connections? Similar to the SQL proxy idea(or maybe identical). On Wed, Apr 16, 2008 at 1:41 PM, RaviKondamuru <[EMAIL PROTECTED]> wrote: > > Here is the thread that talks about multiple database support: > > http://groups.google.com/group/django-users/browse_frm/thread/02fb947b2305b78f/8999719cad4a6010 > Ravi. > > On Apr 16, 6:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > > > This is my first post on this list, so please by gentle and patient ;) > > > > I would like to ask, if it is possible to have DJango running on one > > machine, and have several databases (each with different content) on > > other machines. Basically I would specify a few tables, and each would > > be in different database, while main server would aggregate and > > display this data. Would be also possible, to have different database > > types (i would like to have several sqlite databases and one postgres > > running)? > > > > I need all this for scalability reasons. I am choosing framework for > > the project and what DJango provides seems really cool. If only it > > provides some mechanisms for scalability I guess I will fall in > > love ;-) > > > --~--~-~--~~~---~--~~ 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 to Patch
Follow the instructions on the Django website at http://www.djangoproject.com/download/ and run `svn co http://code.djangoproject.com/svn/django/trunk/` After that, you should be able to `svn up` to get the latest version. On Fri, Apr 18, 2008 at 5:09 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hey guys and gals I want to update my current version of Django .96.1 > by adding patches instead of downloading the current dev version. So > basically I was wondering how do you go about applying patches to this > framework, I ask because I am very used to applying patches by > launching an executable. > > Thanks in advance, > Django newbie > > > --~--~-~--~~~---~--~~ 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: Drop all tables
If you are using SQLite you could just delete the database file. If not, I'm confused at why you'd have access to the shell but not access to the database - do you not have access to the database you are working on or something? If so, I would ask whoever has access to it to drop the tables for you. I don't think there'd be a shell command that would allow you to drop database tables without having database access since that would be a security flaw. If you reply with which DBMS you're using, we can give you specific instructions for how to drop tables. On Mon, May 12, 2008 at 3:47 AM, mwebs <[EMAIL PROTECTED]> wrote: > > Hi, > > is there anyway to drop all tables without falling back to raw sql. I > mean with an shell command or something like that? > > Thank you > > Toni > > > --~--~-~--~~~---~--~~ 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: Drop all tables
Additionally, you could use `django-admin.py flush` to wipe all the database tables and reset them to the state they were in after you initially syncdb'ed. http://www.djangoproject.com/documentation/django-admin/ On Mon, May 12, 2008 at 10:20 AM, Chris Czub <[EMAIL PROTECTED]> wrote: > If you are using SQLite you could just delete the database file. If not, > I'm confused at why you'd have access to the shell but not access to the > database - do you not have access to the database you are working on or > something? If so, I would ask whoever has access to it to drop the tables > for you. I don't think there'd be a shell command that would allow you to > drop database tables without having database access since that would be a > security flaw. > > If you reply with which DBMS you're using, we can give you specific > instructions for how to drop tables. > > > On Mon, May 12, 2008 at 3:47 AM, mwebs <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > is there anyway to drop all tables without falling back to raw sql. I > > mean with an shell command or something like that? > > > > Thank you > > > > Toni > > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ImageField get_X_url() method not respecting MEDIA_URL?
I'm having an issue with the ImageField's get_X_url() method(I think it actually inherits from FileField) not using my MEDIA_URL in the url it forms. *Model:* class ImageUpload(models.Model): image = models.ImageField(help_text='Image to upload', upload_to="uploads/%Y%m%d%H%M%S") class ImageUploadForm(ModelForm): class Meta: model = ImageUpload def clean_image(self): if self.cleaned_data.get('image'): image_data = self.cleaned_data['image'] if not image_data: raise forms.ValidationError('Please upload an image') size = len(image_data.content) if size > 1024000: raise forms.ValidationError('Filesize too large. Expected <= 1 megabyte') return image_data If I call "get_image_url()" on an instance of a ImageUpload model that I have called save_image_file on, I get the resultant url: http://www.mysite.com/uploads/20080603151319/rrbk.jpg However, my settings.py contains the settings: # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '/home/myuser/webapps/static/' # URL that handles the media served from MEDIA_ROOT. # Example: "http://media.lawrence.com"; MEDIA_URL = 'http://www.mysite.com/media' which is correct - the url of the image SHOULD be http://www.mysite.com/media/uploads/20080603151319/rrbk.jpg Any ideas? -Chris Czub --~--~-~--~~~---~--~~ 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: create model instance
http://www.djangoproject.com/documentation/models/fixtures/ What you are looking for is an initial_data fixture. You need to serialize the default instance of the model you want as JSON and save it in initial_data.json and then it should prepopulate when you run syncdb. On Wed, Jun 4, 2008 at 2:31 PM, djangoer <[EMAIL PROTECTED]> wrote: > > A quick newbie question, > > is there any way that can create a default instance (a pre-specified > instance) in the database once the model is created. In other words, > when we first run the syncdb(or set up the website), an pre-defined > instance is created. > > For example, we have a Book model, > > class Book(models.Model): >author = models.CharField(maxlength = 50) >title = models.CharField(maxlength = 50) > > When the website is first setup, we would like to have one default > "Book" instance in the DB, say Book("John.Smith","COMPUT101"). > > Your help is greatly appreciated. > > > --~--~-~--~~~---~--~~ 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: ImageField get_X_url() method not respecting MEDIA_URL?
Thanks, that was it. -Chris On Jun 3, 5:44 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Tue, Jun 3, 2008 at 5:15 PM, Chris Czub <[EMAIL PROTECTED]> wrote: > > # URL that handles the media served from MEDIA_ROOT. > > # Example: "http://media.lawrence.com"; > > MEDIA_URL = 'http://www.mysite.com/media' > > > which is correct - the url of the image SHOULD be > > >http://www.mysite.com/media/uploads/20080603151319/rrbk.jpg > > Unfortunately, that's not correct. Your MEDIA_URL setting needs a > trailing slash in order for Python's urljoin() method to realize that > it's a directory that needs to stay, not just a file that should be > replaced. Change it to 'http://www.mysite.com/media/'and you should > be fine. > > More recent (from just over a year ago) checkouts of Django have an > additional comment added into the default settings.py to outline this > more clearly. > > # URL that handles the media served from MEDIA_ROOT. Make sure to use a > # trailing slash if there is a path component (optional in other cases). > # Examples: "http://media.lawrence.com";, "http://example.com/media/"; > > -Gul --~--~-~--~~~---~--~~ 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: Packaging and transferring code
That really depends on the app and how everything is configured. For example, where are you installing the required Python packages? Do you have a Python lib directory in the application or are you using one of your system's Python include paths? It should not be *too* difficult but depending on how things are laid out, you might need basic Python knowledge(like knowing how imports work and sys.path) to help you debug. On Tue, Feb 14, 2012 at 4:40 PM, Tom wrote: > How time-consuming/difficult is it to package, transfer and deploy the > code of a fully developed site from one host to another? Can a non- > Python/Django dev do this easily? > > -- > 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: High Traffic
You're creating a contrived test though. If you really wanted the count of users you'd probably do a "count" in the database itself. I don't think you're getting any valuable data on your application's actual performance: you basically made a view that just loops over 9000 items. Of course it will be slow if you keep reloading it! Try using a tool like "ab"(Apache Benchmark) or tsung to hit real application pages quickly and concurrently. On Mon, Apr 16, 2012 at 4:41 PM, Yarden Sachs wrote: > what perpesfully used. for heavy system performance > > On 16 באפר 2012 23:38, "andrea mucci" wrote: >> >> have you debugged the mysql query >> >> nginx+fgi work pretty well so is very very strange. >> >> have you tried to test, other type of query result without len method? >> >> >> El 16/04/2012, a las 22:22, Yarden Sachs escribió: >> >> i have 9000 rows. and using mod_wsgi on apache2. what am i doing wrong? i >> tried to switch to nginx+fcgi. and tried ubuntu srrver as well. same >> results. >> >> any ideas? >> >> On 16 באפר 2012 23:18, "andrea mucci" wrote: >>> >>> hi Yarden >>> >>> how many users have you in your database? >>> you use mod_fcgi or mod_python? ( more recommendable will be mod_fcgi or >>> mod_fcgid ) >>> >>> Django is framework that suppert very very large traffic. >>> you can see an example here >>> >>> http://instagram-engineering.tumblr.com/post/13649370142/what-powers-instagram-hundreds-of-instances-dozens-of >>> >>> so, the most important think is configure well all the different >>> component around your project >>> like Apache2 ( big monster ), mod_fcgi etc…. >>> >>> cheers, >>> >>> >>> El 16/04/2012, a las 22:06, Yarden Sachs escribió: >>> >>> using aws ec2 & rds. so rolling out that. i monitor every query for high >>> performance. but Users all is very simple query. >>> >>> >>> what do u think it could other than those? >>> >>> thanks for all the help >>> >>> >>> >>> On Monday, April 16, 2012 10:59:55 PM UTC+3, creecode wrote: Hello Yarden, On Monday, April 16, 2012 12:25:36 PM UTC-7, Yarden Sachs wrote: > Hello, I am using django 1.3 on apache 2.* on windows server 2008. > mysql 5.* > > When i try to access a view that does this: def view(request): > len(User.objects.all()) return HttpResponse() > > i have about 9K results on that. i am doing len and not .count, > because i want to test the server. > > the server becomes reaally slow. Are you running Django and MySQL on the same server box? If so then you are possibly running into speed issues because of contention. There are several Djagno configuration docs on the web that talk about using at least one server for your app and another for your database. Another thing to do is move static files onto their own sever. You might want to try django-debug-toolbar to examine your queries for your webpages to see if you can do some optimization. I highly recommend giving it a go! Of course there are many things one can do to make things faster but you'll need to give us some more info about your setup before we can help you more. Toodle-loo. 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/-/gTlmPOgGsIkJ. >>> 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. >> >> >> -- >> 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. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group.
Re: Heroku.com experiences?
Heroku has been good to me and some of my colleagues so far. They host on AWS so if there was an AWS outage obviously your site would be down(would be nice to be able to fail over to Rackspace or something) but other than that reliability is fine. Their support is very good and responsive as well. More add-ons keep being added to the platform and those make it really easy as a developer to add things(cacheing, databases, message queues, whatever) to your application. I'm a fan. On Fri, May 11, 2012 at 11:58 AM, Bob Carlson wrote: > Thanks for the pointer. That’s one of the nicest sites I have ever seen. It > makes me want to work with them. > > > > Could people out there describe their experiences working with this company? > My needs are low volume, but very high reliability, security and > availability. And of course, ease of use for ME. > > > > Cheers, Bob > > > > Bob Carlson | +1 719 571 9228 (office) | +1 541 521 9525 (mobile) > > b...@rjcarlson.com | rjcarlson49 (aim or skype) > > > > From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] > On Behalf Of Andre Terra > Sent: Thursday, May 10, 2012 07:53 > To: django-users@googlegroups.com > Subject: Re: i need to place my django site on a server, i dont know how to > do it! help!!! > > > > Or just deploy on heroku > > > > http://heroku.com > > > > > > Cheers, > > AT > > > > On Thu, May 10, 2012 at 11:13 AM, eihli wrote: > > This won't be a complete list but it's what I can remember off the top of my > head. > > Things to do: > > Install Python > > Install Django > > Install database software (I chose Postgres. I guess you don't need this if > you are using SQLite3). > > Create database and users and assign permissions. > > Install mod_wsgi. > > Edit your apache httpd.conf file to use > mod_wsgi: http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide > > If you are using apache to serve static html files (like your .css or image > files) then you'll need to add an Alias to your apache config. Something > like: Alias /myproject/static/ /var/www/djangoapps/myproject/media/static > > > > Here are some links I bookmarked while trying to set up a VPS with Django: > > http://www.epicserve.com/blog/2011/nov/3/ubuntu-server-setup-guide-django-websites/ > http://bailey.st/blog/2012/05/02/ubuntu-django-postgresql-and-nginx-a-rock-solid-web-stack/ > > http://blog.kevin-whitaker.net/post/725558757/running-django-with-postgres-nginx-and-fastcgi-on > > http://brandonkonkle.com/blog/2010/jun/25/provisioning-new-ubuntu-server-django/ > > > > > > > On Thursday, 10 May 2012 07:23:11 UTC-5, doniyor wrote: > > Hi there, > > > > i need a small help: i have a django site, which is ready to test. now i > talked to a hosting service, they had only php and mysql supporting server, > but not django. they gave me a virtual server, where i can install django > and put my site there. now i am stuck. i dont know how to install django on > server and which python modules to install that run my site and where to > install. is there any list of steps to do this kind of job? it would be very > helpful. i just dont find a clue where to start. what i understand is: > > apache is webserver and it is there on server. so i need some module that > supports python, right? i decided for mod_wsgi. i dont know why i decided > for this. before that i installed easy_install then i installed all python > packages including django. now when i log in to server thru Putty including > switching to root, i land to: domainname: /www/vhtdocs/domainname # and this > folder has some html files of my old site. they just copied from old server > to this virtual one. now the question is: is it the place where i can just > upload my whole django-site? > > > > i would be very thanksful for some instructions.. > > > > thanks thanks. > > > > Doni > > -- > 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/-/3jzFFzJ9KoEJ. > > > 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. > > -- > 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
Re: Demise of Mr. Kenneth Gonsalves
RIP, Kenneth. He was one of the primary contributors to this list and his contributions will be missed. Condolences go out to all of his friends and family. On Fri, Aug 3, 2012 at 11:20 AM, Anoop Thomas Mathew wrote: > Chronic Asthma. He was hospitalized yesterday, and passed away today. > > > > > > On 3 August 2012 20:45, Marcin Tustin wrote: >> >> What happened to him? He was posting on this list in the last week? >> >> On Fri, Aug 3, 2012 at 11:12 AM, Anoop Thomas Mathew >> wrote: >>> >>> With my heartfelt condolence, I'd like to inform you all the unfortunate >>> demise of Mr.Kenneth Gonsalves (KG - law...@thenilgiris.com), who was a >>> strong advocate of Python, Django and Free Software in India. >>> He had served as the President of IPSS(Indian Python Software Society), >>> which initiated the PyCon India, done a lot of workshops on Python and was >>> an active member in the Django user group. >>> >>> >>> Anoop Thomas Mathew >>> >>> -- >>> 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. >> >> >> >> >> -- >> Marcin Tustin >> Tel: 07773 787 105 >> >> -- >> 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. -- 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: Easy question (I hope)
Shawn -- what do you recommend instead? A friend and I recently had this debate. His suggestion was to split off as much behavior into smaller apps with only a handful of models in the models.py as possible, but I said that if it's not reusable, it shouldn't be an app. I still haven't found a solution for organizing large-scale Django app model structures that I'm happy with. On Fri, Oct 7, 2011 at 10:43 AM, Shawn Milochik wrote: > Make as many files as you want, and make sure you import their classes in > models.py so they get picked up by syncdb. > Normally, to do something like this you'd replace the file (in this case > models.py) with a folder named 'models' containing a file called > __init__.py, and import all the additional files' models in __init__.py. > However, there's some "magic" in Django that doesn't consider a folder a > "Django app" unless it contains a file named models.py. > Also, I recommend you don't do any of the above, because as soon as you > start doing things like creating foreign keys and many-to-many relationships > you're going to have a horrific mess, and probably circular imports. > > -- > 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: Django vs. Ruby on Rails
> 3) Using one or the other for Geographic Information Systems work; I know a lot of GIS people like GeoDjango a lot. I can't comment more than that as I'm not familiar with the field, but it says something that I've heard of GeoDjango but nothing similar for Rails. On Thu, Jan 19, 2012 at 10:59 AM, Brian D wrote: > I'm wondering about diving into Ruby on Rails to qualify for a > position, or spending my time instead going deeper into a full bells > and whistles prototype Django site and betting on jobs opening up in > my field. This is really a GIS career professional question. > > Has anyone here crossed the fence over to Ruby on Rails? What do you > think when: > > 1) Comparing the framework to Django; > > 2) The communities -- friendliness, support, etc.; > > 3) Using one or the other for Geographic Information Systems work; > > 4) (I was going to leave this out but) Comparing Ruby to Python as > languages. > > I think I've generally answered the last question from my own > experience, great integration with spatial libraries, and from other's > recommendations vis-a-vis Ruby on Rails. > > Answer any or all, if you like. > > What concerns me about Django is that, outside of forums like this, > the chatter seems to have died down in the last couple of years from a > peak in 2008/2009. > > I did search the group and haven't seen any recent discussions on this > comparison. > > Any comment really very much appreciated. > > Kind regards, > Brian > > -- > 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: Best way to tell if we're in a test
I think you might be taking the wrong approach. Rather than having your application code checking whether or not it's in a test, have your testing code disable/mock certain behaviors that you don't want exercised(like have it always return that the user answered the security question correctly or something). Python's dynamic nature makes it easy to monkey patch things like this. Look at the Mock class: http://python-mock.sourceforge.net/ On Fri, Apr 29, 2011 at 12:53 PM, Jody McIntyre wrote: > What's the best way to tell (from regular code) if we're in a test? I have > added extra authentication steps (security questions) that would be > difficult to deal with in tests where you just want to run > self.client.login() or post to the login URL. I've noticed that several > third party modules, such as django-digest and django-bcrypt, also disable > parts of their functionality during testing like this: > > from django.core import mail > > if hasattr(mail, 'outbox'): > # we are under a test > else: > # not under a test > > This works, but it's an undocumented side effect so I'm worried it might > change in a future version. What's the correct way to tell if we're in a > test? > > Thanks, > Jody > > -- > 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: python + BDD (Behaviour)
I've had good luck with Lettuce. It's very similar to Cucumber(the test format is the same) so you should be able to jump right in. The terrain features they offer are really useful as well. On Sat, Jun 11, 2011 at 8:58 PM, Mark Curphey wrote: > Thanks. Do most Python folks generally use Selenium ? > > On Jun 11, 2011, at 12:59 PM, Xavier Ordoquy wrote: > >> >> Le 11 juin 2011 à 21:27, Mark Curphey a écrit : >> >>> Similar question: I was looking to see if there is a Python equivalents to >>> Cucumber and Capybara ? >>> >>> On Jun 11, 2011, at 11:27 AM, Guilherme Silveira Elias wrote: >> >> Hi, >> >> You can use freshen or lettuce for that. >> Lettuce has some nice documentation on lettuce.it >> Freshen seems a bit stalled for now, I currently use this branch: >> https://github.com/oesmith/freshen >> >> Regards, >> Xavier. >> >> -- >> 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. > > -- 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's documention is horrible
Yup, that is my approach... The Django sourcecode is eminently readable and well-organized and most of it has documentation associated with it. You can jump into a shell and use the help() command to view API documentation like you requested. e.g. >>> help('django.contrib.auth.models.User') On Mon, Jan 10, 2011 at 5:02 PM, Ovnicraft wrote: > > > On Mon, Jan 10, 2011 at 4:53 PM, Sam Walters wrote: > >> Hi, >> My approach with regard to: >> >> > frameworks I'm used to have at least a well structed API documention >> listing >> > all methods and members of classes with some comment attached to them. >> They >> > also show the class heirachy, quick and simple. >> >> I just look at the source itself for this. >> > > or use pydoc > >> >> >> cheers >> >> sam_w >> >> -- >> 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. >> >> > > > -- > Cristian Salamea > @ovnicraft > > -- > 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.