How to convert the static image files of a readymade template to dynamic
[image: Annotation 2020-06-05 124726.png] Please help me to fix this. Do I need to use a double quotation before and after the .jpg link? -- 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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9abe66f6-06d2-4851-a41c-b45ab129033bo%40googlegroups.com.
Help
Hi Everyone, I have a model with a manyTomany field. I've created an update view for this model and the widget for manyTomany field is FilteredSelectMultiple. How to render the selected value for the manyTomany field in right side box of FilteredSelectMultiple widget while visiting the page? Any help would be appreciated. Thanks, -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/79380f80-db6e-43d8-99af-4f792c037401%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
FilterSelectMultiple Widget's right list box does not render
Hello, I tried to use Django's FilterSelectMultiple Widget. But it does not render the right list box. Any help would be appreciated. Thanks Here is my code: forms.py class appForm(ModelForm): port = forms.ModelMultipleChoiceField(internalapp.objects.all(),widget= FilteredSelectMultiple("Port",False,attrs={'rows':'10'})) class Meta: model = internalapp fields = '__all__' class Media: css = {'all': ('/static/admin/css/widgets.css',), } js = ('/admin/jsi18n/',) views.py def testhome(request): submitted = False if request.method == 'POST' : form = appForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect('/testhome/?submitted=True') else: form = appForm() if 'submitted' in request.GET: submitted = True return render(request, 'tryout/testhome.html', {'form': form, 'submitted': submitted}) templates {% load static %} Document {{ form.media }} {{form.ports }} -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/56f358ec-68d6-46d1-a009-381d65365694%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
overriding Model.save(), do I need to override Model.create() also?
Is it enough to override the Model.save() method or should I override Model.create() also? Does the create() method delegate the creation process to the save() method, or does it bypass it? Thanks, Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
django template language + greater than? does it exist?
is there a greater than method in the template language? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: which class does ####__iexact belong to, where #### is the attribute of a model?
High 5! :-) On Jan 10, 7:30 pm, Christian Joergensen wrote: > rabbi wrote: > > Hi, > > I'm trying to write a generic filter function do something like > > following: > > MyModel.objects.filter( getattr(???,my_dict['search_field'] > > +'__iexact')=my_dict['search_value'] ) > > > But I don't know what to put in place of '???' > > Where does 'field__iexact' actually come from? > > Is it part of MyModel or somewhere else? > > You don't need getattr: > > MyModel.objects.filter(**{ > my_dict['search_field'] + '__iexact': my_dict['search_value'] > > }) > > I believe that will do the trick :) > > Regards, > Christian > > -- > Christian Joergensenhttp://www.technobabble.dk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
which class does ####__iexact belong to, where #### is the attribute of a model?
Hi, I'm trying to write a generic filter function do something like following: MyModel.objects.filter( getattr(???,my_dict['search_field'] +'__iexact')=my_dict['search_value'] ) But I don't know what to put in place of '???' Where does 'field__iexact' actually come from? Is it part of MyModel or somewhere else? Thanks, Alex --~--~-~--~~~---~--~~ 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: template language + accessing specific index in a list
sorry, please ignore. I found it now... murphey's law, as soon as you ask a question you find the answer yourself result_list.0 instead of result_list[0] On Jan 10, 12:56 am, rabbi wrote: > Using django's template language, is there a way of accessing a > specific index in a list without having to iterate over all of it? > Something like this: > {{ result_list[0] }} comes before {{ result_list[1] }} label> > > The example above throws a TemplateSyntaxError with "Could not parse > the remainder: '[0]' from 'result_list[0]'" > > Thanks, > Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
template language + accessing specific index in a list
Using django's template language, is there a way of accessing a specific index in a list without having to iterate over all of it? Something like this: {{ result_list[0] }} comes before {{ result_list[1] }} The example above throws a TemplateSyntaxError with "Could not parse the remainder: '[0]' from 'result_list[0]'" Thanks, Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How can I apply constraints on model relationships?
Hi Malcolm, Filtering out all the Animals that satisfy that constraint is easy... even for a noob like me :) What I want is for that constraint to be enforced as/before the data is inserted as I have a few complex (by my standards) relationships that would benefit from that sort of functionality. I can always write business logic to handle this in the actual app, but I was hoping that functionality was available so I'd have something to fall back on. I'm the only one who will have admin rights so it's no problem from that point, as long as I'm careful when inserting data. Thanks On Jan 9, 1:00 pm, Malcolm Tredinnick wrote: > On Fri, 2009-01-09 at 03:33 -0800, rabbi wrote: > > Is there a way to specify a constraint on a model ManyToMany > > relationship? > > > For example, if I wanted to define an Animal model that has a field > > which specifies which other animals it eats and I wanted to limited > > these animals_I_eat relationships to animals who's specie_name starts > > with "x", how would I do this? > > > E.g. > > > class Animal(models.Model): > > specie_name = models.CharField(max_length=50) > > animals_I_eat = models.ManyToManyField('self',blank=True) > > #where animals_I_eat.specie_name starts with "x" > > > This is probably a very bad example, but I hope you get what I'm > > trying to say > > Do you want this constraint to be enforced for every piece of data that > is inserted? If so, you can't do that yet (sorry!). It requires what > we're calling model-aware validation, at a minimum, and that's something > that we're working on for Django 1.1 (in fact, right this minute, I'm > reviewing some of that code). Essentially, that means form-like > validation for models. > > Or are you asking how to filter out all the Animals that satisfy that > constraint? > > Regards, > Malcolm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How can I apply constraints on model relationships?
Is there a way to specify a constraint on a model ManyToMany relationship? For example, if I wanted to define an Animal model that has a field which specifies which other animals it eats and I wanted to limited these animals_I_eat relationships to animals who's specie_name starts with "x", how would I do this? E.g. class Animal(models.Model): specie_name = models.CharField(max_length=50) animals_I_eat = models.ManyToManyField('self',blank=True) #where animals_I_eat.specie_name starts with "x" This is probably a very bad example, but I hope you get what I'm trying to say Thanks, Alex --~--~-~--~~~---~--~~ 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: "submit" and urls.py fail after moving site from runserver to Apache
Hi Malcolm, I definitely am "starting out", I'm a complete web dev noob... but I was under the impression that I was using GET & POST correctly. I thought GET should be used when the action results in no state change on the server side (e.g. retrievals, queries, etc) and POST was used to alter the state of the server. Is this correct? If it is, then I think GET is appropriate here as I'm not storing any of the data that the form is sending, the data is simply used to query the db. Thanks, Alex On Jan 8, 2:55 am, Malcolm Tredinnick wrote: > On Wed, 2009-01-07 at 11:12 -0800,rabbiwrote: > > [...] > > > I have a submit input on one of my pages and when I run the site on > > runserver it still works fine (I just tried it now) > > However, when I run the exact same site on Apache the url that is > > returned by "submit" is different, and this obviously causes the > > pattern matching in urls.py to fail > > That's not correct. See below. > > > > > > > Here is the html + template script that causes the problem > > > {% if error_message %}{{ error_message }}{% > > endif %} > > > > > {% for entry in entry_list %} > > {{ > > entry.eng_val }} > label> > > > > {% endfor %} > > > > > > > With runserver it returns the following when I press submit: > > "http://127.0.0.1:8000/swenglish/test/submit/"; > > > With Apache it returns the followingwhen I press submit: > > "http://localhost/swenglish/test/submit/?thank > > +you=tack&much=mycket&he=han&fun=roligt&bye=hej+da&snow=sno" > > I don't think this is the problem you think it is. URL pattern matching > in Django doesn't look at the hostname portion of the URL or the query > string (everything after the "?"). So those two URLs should look exactly > the same to Django. When you have DEBUG=True in your settings file, do > you really get the 404 screen saying it couldn't match any URL patterns? > If so, what pattern does it say it was trying to match? > > It looks like something is going wrong in the runserver case, by the > way. Your form is submitted using a GET action, which means the > submitted URL should look like the second case (although the hostname > portion might well be different). It's not clear why you're using GET > and not POST there, by the way -- better to use normal form processing > practice -- which means action="post", not action="get" -- when you're > starting out so that the differences don't make things any harder than > they already are. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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: AlreadyRegistered at /admin/, The model #### is already registered
I've solved it. In case anyone has the same problem, I think it's because 'created_date' is set to auto_now, which means it's not editable and should be in fieldsets This link was helpful: http://www.nabble.com/-Django-Code---7993:-Admin-complains-about-a-missing-field-even-if-it-is-not-missing-td18680119.html Thanks for the suggestions --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: AlreadyRegistered at /admin/, The model #### is already registered
I get the same exception(s) The 1st time I try to import swenglish.admin I get: ImproperlyConfigured: 'EntryAdmin.fieldsets[3][1]['fields']' refers to field 'created_date' that is missing from the form. The 2nd time I try to import swenglish.admin I get: AlreadyRegistered: The model User is already registered These are the same exceptions that I get when trying to load the admin page. The 1st time I try to load admin page I get ImproperlyConfigured After I press refresh (and every subsequent refresh) I get AlreadyRegistered --~--~-~--~~~---~--~~ 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 Models + ManyToMany
Thanks Karen, I actually deleted the thread soon after posting it as I came across what you have written above. Somehow you still managed to reply to a deleted thread though...? Impressive On Jan 9, 1:04 am, "Karen Tracey" wrote: > On Thu, Jan 8, 2009 at 12:06 PM, rabbi wrote: > > > Hi, > > I have a question that is probably very simple to answer. > > > class Example(models.Model): > > value = models.CharField(max_length=200) > > related_examples = models.ManyToMany > > ('self',related_name='related_example_set') > > > If I define a ManyToMany relationship like the one above and I want to > > access all Example's that are related to a specific Example instance, > > which of the following methods should I use? > > > 1) related_examples.all() > > 2) related_examples.all().append(related_example_set.all()) > > > The reason I ask is that it is possible that one instance is assigned > > a relationship to another instance, but the relationship is not > > defined in the other direction. > > > E.g. x.add(y) BUT NOT y.add(x) > > ManyToMany fields to 'self' are symmetrical by default: > > http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod... > > Since you have not specified symmetrical=False I do not think your 2nd > option will even work, since per the docs the example_set attribute will not > be created for a symmetrical ManyToMany relationship to 'self'. > > Karen --~--~-~--~~~---~--~~ 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: AlreadyRegistered at /admin/, The model #### is already registered
OK, thanks I also tried deleting the db file and then calling syncdb again... it didn't help Do you have any suggestions? On Jan 9, 12:17 am, adrian wrote: > syncdb does not modify already existing tables. > so if you modified a model - syncdb will not modify the tables > > On Jan 9, 12:01 am, rabbi wrote: > > > Hi, > > I've search around a bit and found a few references to this error, but > > it seems that everyone else was getting this when they migrated to > > Django 1.0 and newforms... for me it's a different situation, as I > > started on 1.0 from the beginning > > > Background: > > Went through tutorial, got a basic site working fine on runserver > > Migrated site to Apache, site worked fine > > > I wanted to extend the site a bit, so I modified the models and > > performed the following steps: > > modified models.py (changed existing and added new) > > modifed admin.py accordingly > > ran python manage.py syncdb > > restarted Apache > > ALREADY REGISTERED error > > deleted existing db file > > ran python manage.py syncdb > > ALREADY REGISTERED error > > > Does anyone have any suggestions? > > > Thanks, > > Alex --~--~-~--~~~---~--~~ 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: AlreadyRegistered at /admin/, The model #### is already registered
here's my admin.py from mysite.swenglish.models import User from mysite.swenglish.models import Entry from mysite.swenglish.models import Category from mysite.swenglish.models import Language from django.contrib import admin class UserAdmin(admin.ModelAdmin): list_display = ('name', 'password') class EntryAdmin(admin.ModelAdmin): fieldsets = [ (None,{'fields': ['value']}), ('Created Details',{'fields': ['created_date','created_user'], 'classes': ['collapse']}), ('Language & Category',{'fields': ['language','category'], 'classes': ['collapse']}), ('Translations',{'fields': ['translations'], 'classes': ['collapse']}), ] list_filter = ['value'] search_fields = ['created_user','category'] date_hierarchy = 'created_date' class CategoryAdmin(admin.ModelAdmin): fieldsets = [ (None,{'fields': ['value']}), ('Created Details',{'fields': ['created_date','created_user'], 'classes': ['collapse']}), ('Language',{'fields': ['language'], 'classes': ['collapse']}), ('Translations',{'fields': ['translations'], 'classes': ['collapse']}), ] list_filter = ['value'] search_fields = ['created_user'] date_hierarchy = 'created_date' class LanguageAdmin(admin.ModelAdmin): fieldsets = [ (None,{'fields': ['value','value_english']}), ('Created Details',{'fields': ['created_date','created_user'], 'classes': ['collapse']}), ('Translations',{'fields': ['translations'], 'classes': ['collapse']}), ] list_filter = ['value'] search_fields = ['created_user','value_english'] date_hierarchy = 'created_date' admin.site.register(User,UserAdmin) admin.site.register(Entry,EntryAdmin) admin.site.register(Category,CategoryAdmin) admin.site.register(Language,LanguageAdmin) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
AlreadyRegistered at /admin/, The model #### is already registered
Hi, I've search around a bit and found a few references to this error, but it seems that everyone else was getting this when they migrated to Django 1.0 and newforms... for me it's a different situation, as I started on 1.0 from the beginning Background: Went through tutorial, got a basic site working fine on runserver Migrated site to Apache, site worked fine I wanted to extend the site a bit, so I modified the models and performed the following steps: modified models.py (changed existing and added new) modifed admin.py accordingly ran python manage.py syncdb restarted Apache ALREADY REGISTERED error deleted existing db file ran python manage.py syncdb ALREADY REGISTERED error Does anyone have any suggestions? Thanks, Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Django Models + ManyToMany
Hi, I have a question that is probably very simple to answer. class Example(models.Model): value = models.CharField(max_length=200) related_examples = models.ManyToMany ('self',related_name='related_example_set') If I define a ManyToMany relationship like the one above and I want to access all Example's that are related to a specific Example instance, which of the following methods should I use? 1) related_examples.all() 2) related_examples.all().append(related_example_set.all()) The reason I ask is that it is possible that one instance is assigned a relationship to another instance, but the relationship is not defined in the other direction. E.g. x.add(y) BUT NOT y.add(x) Thanks, Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
"submit" and urls.py fail after moving site from runserver to Apache
Hi, I followed the django tutorial and got my site running on runserver + sqlite3 with no problems I then moved the site onto apache + mod_python and (after receiving some help from this group) managed to get the same site semi-running The admin page, home page, and a few others are working as they were with runserver... but I now have a strange problem with one of my pages I have a submit input on one of my pages and when I run the site on runserver it still works fine (I just tried it now) However, when I run the exact same site on Apache the url that is returned by "submit" is different, and this obviously causes the pattern matching in urls.py to fail Here is the html + template script that causes the problem {% if error_message %}{{ error_message }}{% endif %} {% for entry in entry_list %} {{ entry.eng_val }} {% endfor %} With runserver it returns the following when I press submit: "http://127.0.0.1:8000/swenglish/test/submit/"; With Apache it returns the followingwhen I press submit: "http://localhost/swenglish/test/submit/?thank +you=tack&much=mycket&he=han&fun=roligt&bye=hej+da&snow=sno" Any help would be greatly appreciated! Alex --~--~-~--~~~---~--~~ 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: OperationalError at /swenglish/ , no such table: swenglish_entry
i was actually already reading that page... but it's 1:00am and maybe i glazed over it without registering :) i've now temporarily fixed my admin page problem by just copying all files to the apache document root, but later i will need to learn what a "symbolic link" is as it sounds like a nicer solution the online documentation is excellent by the way! this is the first time ive tried web development, first time ive used HTML, python, django, any web server, etc and ive managed to get a basic site up and running largely thanks to the documentation much appreciated alex On Jan 7, 12:52 am, Malcolm Tredinnick wrote: > On Tue, 2009-01-06 at 15:33 -0800, rabbi wrote: > > thanks a lot malcom, that's great advice. > > for the record, initially i had "DATABASE_NAME = 'vocab'" > > > i have another question; after changing from runserver to apache the > > django admin page now looks very ugly... it's lost all formatting etc > > The development server helps you out (and gives false expectations in > the process if you're not paying attention) by automatically serving up > the CSS and Javascript files. This isn't the case when you switch to a > real webserver, since you need to tell the webserver how to find those > files. Django isn't going to automatically serve things like CSS, > images, and Javascript, as they're static files and web servers can do a > much better job serving them and providing things like expiry times than > running it through a Python program. > > This is where I unfortunately have to say "read the documentation," > since we've spent more than a few hours writing up instructions about > this. Have a look at > > http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id1 > > (in fact, read that whole page if you haven't done so already). You > might need to also look up the appropriate documentation in the Apache > manuals (e.g. if you don't know what the Location directive means), but > hopefully things should be reasonably clear if you're already familiar > with Apache configuration a bit and/or take your time. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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: OperationalError at /swenglish/ , no such table: swenglish_entry
thanks a lot malcom, that's great advice. for the record, initially i had "DATABASE_NAME = 'vocab'" i have another question; after changing from runserver to apache the django admin page now looks very ugly... it's lost all formatting etc is this normal or is it a problem i can repair. maybe the admin templates can no longer be located? On Jan 7, 12:23 am, Malcolm Tredinnick wrote: > On Tue, 2009-01-06 at 15:12 -0800, rabbi wrote: > > [...] > > > i've now got it running on apache/mod_python too, but i had to > > hardcode the entire path to the db file in settings.py: > > "DATABASE_NAME = 'C:/Documents and Settings/Rabbi/Desktop/Django > > Code/mysite/vocab'" > > > is this really necessary or is there a nicer way that will work > > anywhere? > > Ah.. that change makes sense. SQLite is a nice database in some ways, > and one of the things it does is not require you to create the database > file ahead of time (it's created when you first access it, although it > will be empty). The drawback is that if you misspell of mis-specify the > database path in any way, a new file is created or accessed somewhere > and will, indeed, be empty. Which is what you were seeing. > > You do need to specify the full path to the database file in your > settings like the above. It's the only way the webserver can know where > it is (your previous setting, whatever it was, happened to work by > accident when you were using "runserver", since it was a relative path > that just happened to be correct relative to where you were running > from). > > Generally, the settings file for a project is one of the things you > should expect to have to make small changes to as you move a collection > of apps around between machines or installations. If you're careful, > when developing, you should be able to set things up so that it's the > *only* file you need to worry about tweaking and even possibly split it > up into settings that are always valid and things like the above, > path-sensitive value, that you know you need to change. Some people put > the stuff they always need to change -- those settings which are > machine-specific -- into a file called, say, local_settings.py and then, > at the end of their settings.py, they write > > try: > from local_settings import * > except ImportError: > pass > > The try...except is just in case you may not always have a > local_settings file, but if you know it's always going to be there, you > might leave out that try...except. Also, by putting this at the end, any > local_settings values will override the previous settings values, which > provides a good way to change things as well. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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: OperationalError at /swenglish/ , no such table: swenglish_entry
>>I've gone through the Django tutorial and it worked fine when using >>the default development server that is provided with Django (python >>manage.py runserver) yeh, like I said. it works fine with the django-provided development server i've now got it running on apache/mod_python too, but i had to hardcode the entire path to the db file in settings.py: "DATABASE_NAME = 'C:/Documents and Settings/Rabbi/Desktop/Django Code/mysite/vocab'" is this really necessary or is there a nicer way that will work anywhere? --~--~-~--~~~---~--~~ 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: OperationalError at /swenglish/ , no such table: swenglish_entry
I forgot to mention, I'm using SQLite3 On Jan 6, 8:59 pm, rabbi wrote: > Hi everyone, > I've gone through the Django tutorial and it worked fine when using > the default development server that is provided with Django (python > manage.py runserver) > > I want to deploy my little test site though, so I've been trying to > get it running on Apache and I keep getting this error: > "OperationalError at /swenglish/ > no such table: swenglish_entry" > > The error seems to be happening on this line: > "entry_list = [e.eng_val + " = " + e.swe_val for e in Entry.objects.all > ()]" > > Apache and mod_python work with a "hello world" test > > I'm running: > Windows XP (sorry) > Python 2.5.4 > mod_python 3.3.1 > Apache 2.2.11 > > Thanks in advance for any help you can give me! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
OperationalError at /swenglish/ , no such table: swenglish_entry
Hi everyone, I've gone through the Django tutorial and it worked fine when using the default development server that is provided with Django (python manage.py runserver) I want to deploy my little test site though, so I've been trying to get it running on Apache and I keep getting this error: "OperationalError at /swenglish/ no such table: swenglish_entry" The error seems to be happening on this line: "entry_list = [e.eng_val + " = " + e.swe_val for e in Entry.objects.all ()]" Apache and mod_python work with a "hello world" test I'm running: Windows XP (sorry) Python 2.5.4 mod_python 3.3.1 Apache 2.2.11 Thanks in advance for any help you can give me! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---