Creating an admin user in production on Spree
Asked Answered
D

2

9

I deployed my Spree app to a server. Locally I can login as an admin and change things, but on the server this password and account does not work. When I go to /admin I get the message authorization failure.

I did already run bundle exec rake spree_auth:admin:create and bundle exec rake db:migrate but this does not work. Furthermore, I can also login with my e-mailaddress and password I got from the hosting company, but I can not go to the admin page.

Does anyone know how I create an admin user?

Deportation answered 6/10, 2013 at 21:0 Comment(0)
A
33

Deploying Spree doesn't (and shouldn't) copy your database from development to production.

So your development admin user doesn't exist on the production database.

SSH into your production server and try:

rake spree_auth:admin:create

Update:

Do this in /data/spree/current

Austere answered 6/10, 2013 at 21:7 Comment(5)
Thanks. I will try that this evening. In which folder on the server should I run this command? Public, shared, or another one?Deportation
There it says: "rake aborted! database configuration does not specify adapter"Deportation
Doing: RAILS_ENV=production bundle exec rake db:migrate helped.Deportation
Glad you figured it out.Austere
in production rake spree_auth:admin:create return error but RAILS_ENV=production rake spree_auth:admin:create works perfectPoulenc
H
0

You can run the DB seeds, which include the admin user:

RAILS_ENV=production bundle exec rake db:seed

If you also want to add sample data, you can run:

RAILS_ENV=production bundle exec rake spree_sample:load
Humidify answered 4/2, 2021 at 10:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.