|
List Info
Thread: Admin without Auth
|
|
| Admin without Auth |
  United States |
2007-02-19 01:32:29 |
Is there a was to install the contrib.admin app without the
contrib.auth app??
While learning, I am eraseing the database and doing
manage.py syncdb
a lot, and it would be real nice to have it come up without
having to
enter username email etc. each time.
Karl
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |

|
2007-02-19 03:05:40 |
On 2/19/07, kbochert <kbochert copper.net> wrote:
>
> Is there a was to install the contrib.admin app without
the
> contrib.auth app??
No; the two are pretty closely intertwined.
> While learning, I am eraseing the database and doing
manage.py syncdb
> a lot, and it would be real nice to have it come up
without having to
> enter username email etc. each time.
There are a few ways around this.
Right now, you can define a signal handler that listens for
a
post_syncdb signal, and adds a user to your application
whenever you
sync the database. If you want to see an example of how this
works,
look at the test_client modeltest, which is part of the
Django test
suite.
However, before v1.0 is released you will have a better
option. You
will be able to define a synchronization fixture - that is,
you will
be able to define a data file that contains the default
contents of
your database. The patch to do this are currently attached
to ticket
#2333 - feel free to try it out if you want to see what will
be
possible in the near future.
Yours,
Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |

|
2007-02-19 03:06:14 |
On 2/19/07, kbochert <kbochert copper.net> wrote:
> Is there a was to install the contrib.admin app without
the
> contrib.auth app??
No; the admin app requires the auth app so that it can
allow
authorized users to log in.
> While learning, I am eraseing the database and doing
manage.py syncdb
> a lot, and it would be real nice to have it come up
without having to
> enter username email etc. each time.
You can provide a SQL file containing an INSERT statement
which will
add a user account, and have it automatically executed by
syncdb; see
the documentation on initial SQL:
http://www.djangoproject.
com/documentation/django_admin/#sqlinitialdata-appname-appna
me
Generally, you'll just want to copy the values out of the
admin page
for your user account, and write an INSERT which will add
that data to
the DB.
--
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |
  United States |
2007-02-19 12:55:06 |
None of those suggestions seem to help
-- Should I use a method that will break in 1.0??
-- As a beginner, I am loath to try patching Django
-- I have no test_client in my Django distribution
-- I see how to provide a .sql file, but how do I put a
super user in
it?
Perhaps I'm just going at this wrong. The problem is that
I'm a
beginner, going down
many false pathways. As such, I create a model, play around
with it a
bit, modify it
and play some more. Every change seems to require that I
erase the
database,
recreate it with syncdb, and reenter my superuser data.
Two things make this difficult:
1)-- Any data I have added to the database disappears on
each cycle
2)-- The process of entering the superuser is most annoying
for a hunt-
and-peck typist
who is a beginner (has to do it often), and an amateur
(works on this
sporadically).
I can accept that Django may not be able to add, delete, or
rename a
field without me erasing the database,
But couldn't it at least syncdb with an automatically
created
superuser ( at least in the development environment)?
Karl
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |

|
2007-02-19 13:07:19 |
On 2/19/07, kbochert <kbochert copper.net> wrote:
> -- I see how to provide a .sql file, but how do I put a
super user in
> it?
Something like
BEGIN;
INSERT INTO "auth_user" ('username', 'email',
'password') VALUES
('me', 'my email.com', 'my_hashed_password');
COMMIT;
Just straightforward SQL.
--
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |

|
2007-02-19 13:08:13 |
On 2/19/07, James Bennett <ubernostrum gmail.com> wrote:
> Something like
>
> BEGIN;
> INSERT INTO "auth_user" ('username', 'email',
'password') VALUES
> ('me', 'my email.com', 'my_hashed_password');
> COMMIT;
(and, of course, the appropriate value of True for the DB
you're
using, on the 'is_staff', 'is_active' and 'is_superuser'
columns).
--
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |
  United States |
2007-02-19 13:22:58 |
On Feb 19, 11:08 am, "James Bennett"
<ubernost... gmail.com> wrote:
> On 2/19/07, James Bennett <ubernost... gmail.com> wrote:
>
> > Something like
>
> > BEGIN;
> > INSERT INTO "auth_user" ('username',
'email', 'password') VALUES
> > ('me', '... email.com', 'my_hashed_password');
> > COMMIT;
>
> (and, of course, the appropriate value of True for the
DB you're
> using, on the 'is_staff', 'is_active' and
'is_superuser' columns).
>
That part I get ( but thanks for detailing it, and saving me
hours of
searching and stupid errors)
How do I generate a hashed password?
Does the sql go into myapp/sql/ or
django/contrib/admin/sql?
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |

|
2007-02-19 13:40:56 |
On 2/19/07, kbochert <kbochert copper.net> wrote:
> How do I generate a hashed password?
The easiest way is actually to manually create the superuser
once
during a syncdb run, and then copy/paste the hash out of the
admin
page for that user. You can manually generate a hash if you
want to,
but it's a little more work.
> Does the sql go into myapp/sql/ or
django/contrib/admin/sql?
It can technically go anywhere, but the best place is
dango/contrib/auth/sql to ensure it's executed only after
the auth
users table is created.
--
"Bureaucrat Conrad, you are technically correct -- the
best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |
  United States |
2007-02-19 14:39:26 |
On Feb 19, 11:40 am, "James Bennett"
<ubernost... gmail.com> wrote:
> On 2/19/07, kbochert <kboch... copper.net> wrote:
>
> > How do I generate a hashed password?
>
> The easiest way is actually to manually create the
superuser once
> during a syncdb run, and then copy/paste the hash out
of the admin
> page for that user. You can manually generate a hash if
you want to,
> but it's a little more work.
>
> > Does the sql go into myapp/sql/ or
django/contrib/admin/sql?
>
> It can technically go anywhere, but the best place is
> dango/contrib/auth/sql to ensure it's executed only
after the auth
> users table is created.
>
No luck. I put:
BEGIN;
INSERT INTO "auth_user" ('username', 'email',
'password') VALUES
('admin', 'me mysite.com',
'sha1$b0461$2ed273ea30cf73581'); #'admin'
COMMIT;
BEGIN;
INSERT INTO "auth_user" ('is_staff', 'is_active',
'is_superuser')
VALUES
('True', 'True', 'True');
COMMIT;
into:
django/contrib/auth/sql/user.sql
and syncdb still says ''You have just installed Django's
auth system,
which means you
don't have any superusers defined."
If I decline to create one, I can't log in.
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Admin without Auth |

|
2007-02-19 14:46:12 |
On 2/19/07, kbochert <kbochert copper.net> wrote:
>
>
>
> On Feb 19, 11:40 am, "James Bennett"
<ubernost... gmail.com> wrote:
> > On 2/19/07, kbochert <kboch... copper.net> wrote:
> >
> > > How do I generate a hashed password?
> >
> > The easiest way is actually to manually create the
superuser once
> > during a syncdb run, and then copy/paste the hash
out of the admin
> > page for that user. You can manually generate a
hash if you want to,
> > but it's a little more work.
> >
> > > Does the sql go into myapp/sql/ or
django/contrib/admin/sql?
> >
> > It can technically go anywhere, but the best place
is
> > dango/contrib/auth/sql to ensure it's executed
only after the auth
> > users table is created.
> >
>
> No luck. I put:
>
> BEGIN;
> INSERT INTO "auth_user" ('username',
'email', 'password') VALUES
> ('admin', 'me mysite.com',
'sha1$b0461$2ed273ea30cf73581'); #'admin'
> COMMIT;
>
> BEGIN;
> INSERT INTO "auth_user" ('is_staff',
'is_active', 'is_superuser')
> VALUES
> ('True', 'True', 'True');
> COMMIT;
>
> into:
> django/contrib/auth/sql/user.sql
>
> and syncdb still says ''You have just installed
Django's auth system,
> which means you
> don't have any superusers defined."
>
> If I decline to create one, I can't log in.
what exactly are you doing?
this approach works perfectly for me...
>
>
>
>
>
>
> >
>
--
Honza Kr�l
E-Mail: Honza.Kral gmail.com
ICQ#: 107471613
Phone: +420 606 678585
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
|
|