newbie: concept question
Hi all, I looked for FAQ, but I couldn't find any. Here's my question. I've been working through the tutorials. I've taken a community college class on Python. So, I have some background there. I've gotten Django installed and working. So far, I've used sqlite3. Here's the question: If you have an MySql database that is already establised with data, etc, how do you get Django to set up the abstraction of the db, so that you can access the data. I've worked with the tutorials where you use Django to create the database. You use syncdb command to setup the "abstraction" of the data. How do you do it the other direction? Thanks for all your help. Steve -- 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: concept question
Thanks for your help. I'll look into your suggestions. Steve On Nov 26, 5:08 pm, Łukasz Rekucki wrote: > On 26 November 2010 21:09, Charlietuna wrote: > > > Hi all, > > > I looked for FAQ, but I couldn't find any. Here's my question. I've > > been working through the tutorials. I've taken a community college > > class on Python. So, I have some background there. > > I've gotten Django installed and working. So far, I've used sqlite3. > > > Here's the question: If you have an MySql database that is already > > establised with data, etc, > > how do you get Django to set up the abstraction of the db, so that you > > can access the data. > > > I've worked with the tutorials where you use Django to create the > > database. You use syncdb command to setup the "abstraction" of the > > data. How do you do it the other direction? > > If you have an existing schema in your database, you can use > django-admin.py inspectdb[1] to create models from it. It's not > guaranteed to be 100% correct, so you may need to tweak the generated > models. If you have a database table that you want to access, but > don't won't Django to manage it's schema, you can use > "managed=False"[2] on the model. Hope that helps :) > > [1]:http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb > [2]:http://docs.djangoproject.com/en/dev/ref/models/options/#managed > > -- > Łukasz Rekucki -- 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.
newbie question: @login_required, can't get it to work
Hi All, I'm a newbie. I would like to use the @login_required decorator, but I don't want to redirect to the standard default accounts/login. I would like to redirect to '/login/' The book says add the following to the end of the settings.py file.: import django.contrib.auth django.contrib.auth.LOGIN_URL = '/login/' The server says: GET /accounts/login/?login/=/save/ HTTP/1.1 404 2273 I assume that it is going the path: /account/login/login Any help would be appreciated! Thanks, Steve -- 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 question: @login_required, can't get it to work
Thank you sooo much. That was great. I was using a book base on Django .96. I couldn't fully understand the online documentation. You saved me a great deal of time. Steve On Dec 8, 11:22 pm, Martin Melin wrote: > On Thu, Dec 9, 2010 at 8:04 AM, Charlietuna wrote: > > Hi All, > > > I'm a newbie. I would like to use the @login_required decorator, but I > > don't want to redirect to the standard default accounts/login. I would > > like to redirect to '/login/' > > > The book says add the following to the end of the settings.py file.: > > > import django.contrib.auth > > django.contrib.auth.LOGIN_URL = '/login/' > > Not sure where you're getting this information from, but assuming > you're using the latest Django: > > http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-LOGIN_URL > > i.e. you should be using settings.LOGIN_URL and not > django.contrib.auth.LOGIN_URL since at least 1.0 > > Cheers, > Martin Melin > > > > > The server says: GET /accounts/login/?login/=/save/ HTTP/1.1 404 2273 > > I assume that it is going the path: > > > /account/login/login > > > Any help would be appreciated! > > > Thanks, > > > Steve -- 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 question: @login_required, can't get it to work
Thank you sooo much. That was great. I was using a book base on Django .96. I couldn't fully understand the online documentation. You saved me a great deal of time. Steve On Dec 8, 11:20 pm, robin nanola wrote: > on your settings.py you can just add LOGIN_URL = '/login/' > > On Thu, Dec 9, 2010 at 3:04 PM, Charlietuna wrote: > > Hi All, > > > I'm a newbie. I would like to use the @login_required decorator, but I > > don't want to redirect to the standard default accounts/login. I would > > like to redirect to '/login/' > > > The book says add the following to the end of the settings.py file.: > > > import django.contrib.auth > > django.contrib.auth.LOGIN_URL = '/login/' > > > The server says: GET /accounts/login/?login/=/save/ HTTP/1.1 404 2273 > > I assume that it is going the path: > > > /account/login/login > > > Any help would be appreciated! > > > Thanks, > > > Steve > > > -- > > 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.