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?

user2609980
  • 10,264
  • 15
  • 74
  • 143

2 Answers2

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

manishie
  • 5,302
  • 1
  • 20
  • 21
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
jibai31
  • 1,663
  • 18
  • 22