Re: installer
On 25/04/2011 5:14am, ydjango wrote: Thanks Mike, I will use what you suggested as interim step and to automate my own processes. I want to provide it as shrink wrapped downloadable software that customer can install via guided install. And I do not want provide the source code. Bit out of my area. I typically use distutils setup.py. I have used py2exe for Windows which delivers compiled code and more or less hides the source but that was only so that I could deliver working software to machines without a Python installation. Not sure what to recommend ... Mike What would be the best way to do it? - Any tools that can help me? On Apr 4, 9:57 pm, Mike Dewhirstwrote: On 5/04/2011 12:04pm,ydjangowrote: Is there a package or easy way to create an installer to auto install apache, django, mysql based web app? The best way is to script the installation. Google for "scripted installs" or similar. You should find some examples you can rework to suit your needs. I think this is a very healthy way to install stuff just in case you need to repeat the process on another machine. The scripts leave a nice record of what you have installed. There could be some manual steps like installing mysql and providing setup screens to enter connection data to mysql and mail server. I would want to at minimum, when installer is run by user, auto install all the many python packages, install django and build my app, and delete py files automatically. For Python applications you can also script installation. I usually call the Python script at the end of the os instyallation script. I use pip and here is an example. I uncomment lines as required and comment them out again after a successful install so I don't accidentally re-install. You need to study the documentation for pip if you decide to use it ... # # requires 1. setuptools and 2. pip # #pip install django #pip install markdown #pip install psycopg2 #pip install south #pip install django-tagging #pip install django-cms # having trouble with buildbot/twisted - debug via /usr/local/lib64 #pip install buildbot #pip install akismet Mike -- 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: Checking for user type in view
On 25/04/2011 7:15am, Kenny Meyer wrote: Hello guys, In my application models I have two models, Judge and Participant: Another way might be to use django groups. Have a participant group and a judge group and pop your users into one or the other. I prefer this approach for my own purposes because it means the user can be either or both. When it comes right down to it they are both users. Mike from django.contrib.auth.models import User class Judge(User): pass class Participant(User): pass In my view I want to find out if the authenticated user is either a Judge or a Participant. How can I do that? I have done the following, and it works most of the time for me: def index(request): user = request.user if user.is_authenticated(): if user.is_superuser: return redirect('/admin') judge = None participant = None competition = None try: participant = user.participant or None judge = user.judge or None if participant: competition = participant.competition if judge: competition = judge.competition except Participant.DoesNotExist, e: pass except Judge.DoesNotExist, e: pass except Exception, e: raise # Do some more stuff... But this is ugly. It would be cool if you could come up with better ideas. Kenny -- 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 to register EmployeeAdmin using atributes in Person class
I still having a little problem using OneToOne relationship and Edit form. The forms are created with combobox and get all address in database, i need the address of the specific Employee only. Anybody know fix this problem? Thanks! 2011/4/23 Guevara> I got put in the form of employee the form of Houses using > StackedInline: > > > class HouseInline(admin.StackedInline): >model = House >max_num = 1 > > class EmployeeAdmin(admin.ModelAdmin): >search_fields = ['person__name','person__cpf'] >list_display = ("name","cpf","date_born","date_inclusion") >ordering = ["-name"] > list_filter = ("date_inclusion",) >list_per_page = 10 > inlines = [HouseInline] > > admin.site.register(Employee, EmployeeAdmin) > > Now I need collapse the forms of Houses in edit form of Employee, if I > register mora than 2 houses, I have two forms of Houses in edit form > employee. =/ > And the address combobox still showing all address register in > database, i need show olnly adress of employee or adress of the house. > > Thanks. > > > > > On 23 abr, 12:46, Guevara wrote: > > Thank you Ramiro! > > > > Now i have the atributes Person in form Employee. =) > > > > I added the attribute address and house in Employee class: > > > > models.py > > > > class Employee(Person): > > person = models.OneToOneField(Person, parent_link=True) > > # Relationship OneToOne with Address > > address = models.OneToOneField(Address) > > # Relationship with Houses > > house = models.ForeignKey(Houses) > > > > def __unicode__(self): > > if self.person: > > return "%s %s (%s)" % (self.name, self.tel, self.address) > > else: > > return "%s (%s)" % (self.name, self.address) > > > > admin.py > > > > from django.contrib import admin > > from imobiliaria.employee.models import Employee > > admin.site.register(Employee) > > > > But when registering a new Employee, the form show in the combobox > > others addresses and other houses of other entries, you know how I can > > fix? > > > > Thanks!! > > > > On 23 abr, 00:22, Ramiro Morales wrote: > > > > > > > > > > > > > > > > > On Fri, Apr 22, 2011 at 11:55 PM, Guevara > wrote: > > > > [...] > > > > > > class Person(models.Model): > > > >name = models.CharField(max_length=50) > > > >date_inclusion = models.DateField() > > > > > > class Employee(models.Model): > > > >person = models.OneToOneField(Pessoa) > > > > > > I reed this dochttp:// > docs.djangoproject.com/en/dev/ref/contrib/admin/ > > > > but could not find this information. > > > > > Try with > > > > > class Employee(Person): > > > person = models.OneToOneField(Person, parent_link=True) > > > > > or simply with > > > > > class Employee(Person): > > > pass > > > > > It you don't want/need control of the name of the 1to1 relationship > > > between Employee and Person. > > > > > Also, see > > > > > > http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield > .. > > > > > -- > > > 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. > > -- 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: avatar or thumbnails
PIL (Python Imaging library) is the engine that pretty much powers this functionality on most sites. TO make it easier, look at the sorl and imagekit apps, they do all the heavy lifting for you. On Apr 24, 10:20 pm, xeedwrote: > hi im noob in django, i need help, i want have an avatar or thumbnail > in my project, but i have nothing idea how i can integrate in my > project, I have python 27, and django 1.3 > i need a sample project with avatar or thumbnail inside the sample, > then i will see how integrate in my project. > > thks a lot in advance for your help -- 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.
avatar or thumbnails
hi im noob in django, i need help, i want have an avatar or thumbnail in my project, but i have nothing idea how i can integrate in my project, I have python 27, and django 1.3 i need a sample project with avatar or thumbnail inside the sample, then i will see how integrate in my project. thks a lot in advance for your help -- 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: Ajax headers not work in all browsers?
Here's the header in request as seen from Firebug: Request Headers Hostlocalhost:8000User-Agent Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0) Gecko/20100101 Firefox/4.0Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5Accept-Encodinggzip, deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive115Connection keep-aliveReferer http://localhost:8000/home2 Cookie__utma=111872281.1574255346.1303689518.1303691822.1303693660.3; __utmc=111872281; __utmz=111872281.1303689518.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionid=498174cb74222f0570fead661c787935; __utmb=111872281.5.10.1303693660 2011/4/24 Daniel França> There are some django middleware classes to test the browser compatibility, > can it be a problem? > > There's no cross domain call, it's all about my domain =/ > It's necessary to set the mimetype in a get/load method? > What else information can I post here to help? > > > On Sun, Apr 24, 2011 at 2:44 AM, Masklinn wrote: > >> On 24 avr. 2011, at 04:38, Daniel França wrote: >> >> Hi all, >> I was using JQuery to retrieve some data using AJAX and Django... >> at my django view code I wrote a verification to check if it's an ajax >> request: >> *if request.is_ajax():* >> * #Ajax handler* >> *else:* >> * #Not Ajax handler* >> >> and do the properly handler, and here's my Jquery script: >> $('#id_show_updates').load("/profiles/get_updates/"+ >> document.getElementById('last_update').innerHTML); >> >> It's working like a charm in Chrome and Opera... but at Firefox django >> thinks it's not Ajax and =/ Anyone know someway to solve that? >> >> Best Regards, >> Daniel França >> >> Would you per chance have some kind of redirection (any redirection) per >> chance? >> >> Firefox will not forward any explicitly set header (including Ajax ones) >> across redirections. >> >> -- >> 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: Checking for user type in view
On Sun, Apr 24, 2011 at 5:23 PM, Shawn Milochikwrote: > It's not recommended that you subclass User. > > Better: Create a class to use for a user profile and associate it with > the User using the instructions here: > > http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users I should have read that section before. This is much better in the long run. Thanks, Shawn. -- 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: Checking for user type in view
> I have done the following, and it works most of the time for me: > > def index(request): > user = request.user > if user.is_authenticated(): > if user.is_superuser: > return redirect('/admin') > > judge = None > participant = None > competition = None > try: > participant = user.participant or None > judge = user.judge or None > if participant: > competition = participant.competition > if judge: > competition = judge.competition > except Participant.DoesNotExist, e: > pass > except Judge.DoesNotExist, e: > pass > except Exception, e: > raise > # Do some more stuff... Actually this *doesn't* work most of the time for me, because the moment user.participant raises an exception I'm screwed. -- 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: Checking for user type in view
It's not recommended that you subclass User. Better: Create a class to use for a user profile and associate it with the User using the instructions here: http://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users Then give that class a 'role' field or something and use that. You can use request.user.get_profile() to get at it in your views. It's cleaner and easier than subclassing User. Shawn -- 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.
Checking for user type in view
Hello guys, In my application models I have two models, Judge and Participant: from django.contrib.auth.models import User class Judge(User): pass class Participant(User): pass In my view I want to find out if the authenticated user is either a Judge or a Participant. How can I do that? I have done the following, and it works most of the time for me: def index(request): user = request.user if user.is_authenticated(): if user.is_superuser: return redirect('/admin') judge = None participant = None competition = None try: participant = user.participant or None judge = user.judge or None if participant: competition = participant.competition if judge: competition = judge.competition except Participant.DoesNotExist, e: pass except Judge.DoesNotExist, e: pass except Exception, e: raise # Do some more stuff... But this is ugly. It would be cool if you could come up with better ideas. Kenny -- 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: installer
Thanks Mike, I will use what you suggested as interim step and to automate my own processes. I want to provide it as shrink wrapped downloadable software that customer can install via guided install. And I do not want provide the source code. What would be the best way to do it? - Any tools that can help me? On Apr 4, 9:57 pm, Mike Dewhirstwrote: > On 5/04/2011 12:04pm,ydjangowrote: > > > Is there a package or easy way to create an installer to auto install > > apache, django, mysql based web app? > > The best way is to script the installation. Google for "scripted > installs " or similar. You should find some examples you can > rework to suit your needs. > > I think this is a very healthy way to install stuff just in case you > need to repeat the process on another machine. The scripts leave a nice > record of what you have installed. > > > There could be some manual steps like installing mysql and providing > > setup screens to enter connection data to mysql and mail server. > > I would want to at minimum, when installer is run by user, auto > > install all the many python packages, install django and build my app, > > and delete py files automatically. > > For Python applications you can also script installation. I usually call > the Python script at the end of the os instyallation script. I use pip > and here is an example. I uncomment lines as required and comment them > out again after a successful install so I don't accidentally re-install. > You need to study the documentation for pip if you decide to use it ... > > # > # requires 1. setuptools and 2. pip > # > #pip install django > #pip install markdown > #pip install psycopg2 > #pip install south > #pip install django-tagging > #pip install django-cms > # having trouble with buildbot/twisted - debug via /usr/local/lib64 > #pip install buildbot > #pip install akismet > > Mike -- 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: Ajax headers not work in all browsers?
There are some django middleware classes to test the browser compatibility, can it be a problem? There's no cross domain call, it's all about my domain =/ It's necessary to set the mimetype in a get/load method? What else information can I post here to help? On Sun, Apr 24, 2011 at 2:44 AM, Masklinnwrote: > On 24 avr. 2011, at 04:38, Daniel França wrote: > > Hi all, > I was using JQuery to retrieve some data using AJAX and Django... > at my django view code I wrote a verification to check if it's an ajax > request: > *if request.is_ajax():* > * #Ajax handler* > *else:* > * #Not Ajax handler* > > and do the properly handler, and here's my Jquery script: > $('#id_show_updates').load("/profiles/get_updates/"+ > document.getElementById('last_update').innerHTML); > > It's working like a charm in Chrome and Opera... but at Firefox django > thinks it's not Ajax and =/ Anyone know someway to solve that? > > Best Regards, > Daniel França > > Would you per chance have some kind of redirection (any redirection) per > chance? > > Firefox will not forward any explicitly set header (including Ajax ones) > across redirections. > > -- > 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: Ajax headers not work in all browsers?
It is not exactly clear what your issues are, so I will make a guess that it is HTTP headers (mimetype). For JSON it should be application/ json, but IE will not work with this even thought it is the required standard. The solutions to this is to generally use IFRAME's which means rethinking you implementation. If the above is not related to your issue then it could be that you are doing a cross domain call which is not allowed in the AJAX standard, some browsers will allow it however. There are cross browser ways of getting around this. In Jquery there is a crossDomain setting in the .ajax call as of version 1.5 and up. If none of the above are hitting on your issue you need to be more specific about your problem then somebody can answer you properly. ~Carl On Apr 23, 9:38 pm, Daniel Françawrote: > Hi all, > I was using JQuery to retrieve some data using AJAX and Django... > at my django view code I wrote a verification to check if it's an ajax > request: > *if request.is_ajax():* > * #Ajax handler* > *else:* > * #Not Ajax handler* > > and do the properly handler, and here's my Jquery script: > $('#id_show_updates').load("/profiles/get_updates/"+ > document.getElementById('last_update').innerHTML); > > It's working like a charm in Chrome and Opera... but at Firefox django > thinks it's not Ajax and =/ Anyone know someway to solve that? > > Best Regards, > Daniel França -- 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.
URLs in error messages from form validation
Hello all, say I have a following form: class MyForm(forms.Form): id = forms.IntegerField(max_length=9) language = forms.CharField(max_length=10) file = forms.FileField() And a following pseudo clean method: def clean(self): for file in self.files.values(): if file_exists(file): raise forms.ValidationError('We already have this file here') return self.cleaned_data So I want to display a URL in the error message. The text is displayed fine, but the URL is being escaped by Django and thus is not clickable. Is there some way to disable it for this specific case? The form is being rendered like: id="upload">{% csrf_token %} {{ form.as_table }} type="reset" value="Reset" /> Thanks. -- Kind regards Daniel Gerzo -- 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: cx_Oracle error: ImproperlyConfigured
On Apr 23, 12:29 pm, kamal sharmawrote: > No it was .profile of mine. Now I have set the LD_LIBRARY_PATH in app.wsgi > as mentioned below and when I print the os.environ in the beginning of > views.py then it shows that newly added value. It's clear that your LD_LIBRARY_PATH is fine at this point, since the library must be loaded in order to get the ORA-01804 error. The problem, as Jirka and I have suggested, is that the rest of your Oracle installation is still not visible to the process, which is preventing the client from reading its data files. Why this is the case is unclear without knowing more details about your system. Is the Oracle directory readable by the WSGI user? Is the WSGI process running inside a chroot jail? -- 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 1.1 performance versus django 1.2 performance
I am experiencing considerable performance problems with ORM requests, too. In django 1.2.3. And I found two slow procedures: first is queryset cloning (sql.Query objects deepcopying is actually slow) and second - sql generation (especially, generating list of fields). Both could be a result of adding new features that made sql.Query objects very complex. I opened a topic about expensive cloning on django-developers: http://groups.google.com/group/django-developers/browse_thread/thread/5943bc1bab0711b0/95ab0714ef746469?lnk=gst=queryset+cloning#95ab0714ef746469 and found some people with same problem. I also use a monkey patch to avoid this problem by making querysets mutating, not cloning: https://gist.github.com/872145 -- 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: extending a shopping cart
The model vs name issue has to do with lower case vs capitalized letters . To get the model attribute look up info in_meta.fields On Apr 23, 9:52 am, shoftywrote: > ok, answering my own question here, kind of. > > attempt 1. > # get the objects for this content type, then choose the object by id > ct = ContentType.objects.get_for_model(app_label=app, > name=content_type) > p = ct.get_object_for_this_type(pk=object_id) > > the above code works to get the object and allows me to add the object > to the cart. > > im not sure why name=content_type works when model=content_type isnt > working. > its got to be to do with the line that populates content_type, which > is > > form.fields['content_type'].widget.attrs['value'] = > ContentType.objects.get_for_model(SuspFitment) > > so this is returning the name for the model, how would i go about > returning the model attribute? -- 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: Connecting to a database
Thanks Mate, Have a good one! ** On Sun, Apr 24, 2011 at 6:53 AM, Andrew Volozhaninwrote: > yes, SQLite doesn't use any SQL server. It consists of a database file. > That's why you access sqlite databases by the filename. > But mySQL, postgresql use such servers. And you access them by connecting > to these servers. > > -- > 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: Connecting to a database
yes, SQLite doesn't use any SQL server. It consists of a database file. That's why you access sqlite databases by the filename. But mySQL, postgresql use such servers. And you access them by connecting to these servers. -- 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: Connecting to a database
That makes sense. Can you please tell me then, if os.path.dirname(os.path.abspath( __file__ )) + '/ database/local.db', would be something relative to SQLite? Many thanks *José Pablo Méndez * On Sun, Apr 24, 2011 at 1:34 AM, Daniel Rosemanwrote: > On Sunday, April 24, 2011 7:46:43 AM UTC+1, Hurin wrote: >> >> Hi, >> >> I have a python script where I have to fill the following info to >> connect to my DB: >> >> DATABASES = { >> 'default': { >> 'ENGINE': 'sqlite3','mysql', # Add 'postgresql_psycopg2', >> 'postgresql', 'mysql', 'sqlite3' or 'oracle'. >> 'NAME': os.path.dirname(os.path.abspath( __file__ )) + '/ >> database/local.db', # Or path to database file if using sqlite3. >> 'USER': '', # Not used with sqlite3. >> 'PASSWORD': '', # Not used with sqlite3. >> 'HOST': '', # Set to empty string for >> localhost. Not used with sqlite3. >> 'PORT': '', # Set to empty string for >> default. Not used with sqlite3. >> }, >> >> >> I am not familiar with python, I know that os.path.dirname is a way to >> reference the location where the script is being run, but I am not >> sure if it is the right syntax to point to my database. Should I leave >> it like that or would it be something like >> >> mysql://localhost:3306/dbName" >> >> For reference, I am trying to install CDR-Stats and I have python- >> django and python-mysqldb installed. >> >> Thanks to whoever can point me out in the right direction > > > The file path of the script has nothing to do with this. You need to put in > how the script accesses the database. For you: > > DATABASES = { > 'default': { > 'ENGINE': 'mysql', > 'NAME': 'dbName', > 'USER': '', > 'PASSWORD': '', > 'HOST': '', > 'PORT': '', > }, > > Your HOST and PORT are the defaults, so they can be left blank. You will > need to put in the username and password of your MySQL user though. > -- > DR. > > -- > 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: extending a shopping cart
yeah, think i've found it. .model_class() worked, but game a strange result, so needs more investigation. thanks for the pointer mate. On Apr 23, 4:33 pm, Shawn Milochikwrote: > Did you check out the docs for adding a generic foreign key to your > model itself? -- 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: Connecting to a database
On Sunday, April 24, 2011 7:46:43 AM UTC+1, Hurin wrote: > > Hi, > > I have a python script where I have to fill the following info to > connect to my DB: > > DATABASES = { > 'default': { > 'ENGINE': 'sqlite3','mysql', # Add 'postgresql_psycopg2', > 'postgresql', 'mysql', 'sqlite3' or 'oracle'. > 'NAME': os.path.dirname(os.path.abspath( __file__ )) + '/ > database/local.db', # Or path to database file if using sqlite3. > 'USER': '', # Not used with sqlite3. > 'PASSWORD': '', # Not used with sqlite3. > 'HOST': '', # Set to empty string for > localhost. Not used with sqlite3. > 'PORT': '', # Set to empty string for > default. Not used with sqlite3. > }, > > > I am not familiar with python, I know that os.path.dirname is a way to > reference the location where the script is being run, but I am not > sure if it is the right syntax to point to my database. Should I leave > it like that or would it be something like > > mysql://localhost:3306/dbName" > > For reference, I am trying to install CDR-Stats and I have python- > django and python-mysqldb installed. > > Thanks to whoever can point me out in the right direction The file path of the script has nothing to do with this. You need to put in how the script accesses the database. For you: DATABASES = { 'default': { 'ENGINE': 'mysql', 'NAME': 'dbName', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', }, Your HOST and PORT are the defaults, so they can be left blank. You will need to put in the username and password of your MySQL user though. -- DR. -- 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.
Connecting to a database
Hi, I have a python script where I have to fill the following info to connect to my DB: DATABASES = { 'default': { 'ENGINE': 'sqlite3','mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': os.path.dirname(os.path.abspath( __file__ )) + '/ database/local.db', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. }, I am not familiar with python, I know that os.path.dirname is a way to reference the location where the script is being run, but I am not sure if it is the right syntax to point to my database. Should I leave it like that or would it be something like mysql://localhost:3306/dbName" For reference, I am trying to install CDR-Stats and I have python- django and python-mysqldb installed. Thanks to whoever can point me out in the right direction -- 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.