DjangoGirls / tutorial-extensions

Additional tasks for tutorial
https://tutorial-extensions.djangogirls.org
Other
163 stars 203 forks source link

Problems with Deploy your website on Heroku #76

Closed yenly closed 1 year ago

yenly commented 7 years ago

I'm working through the exercise and is running into issues with database migration. I followed the instructions to change to PostgreSQL installation. I run $ heroku run python manage.py migrate and I get all the stats staying ok. But yet when I run $ heroku run python manage.py createsuperuser I get errors saying database doesn't exist. I tried googling for answers but can't find a solution. Are these instructions outdated compared to Heroku?

(myvenv) Yenlys-MacBook-Pro:django_girls yenlyma$ heroku run python manage.py migrate
Running python manage.py migrate on ⬢ ydgblog... up, run.6320 (Free)
Operations to perform:
  Apply all migrations: admin, auth, blog, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying blog.0001_initial... OK
  Applying blog.0002_comment... OK
  Applying sessions.0001_initial... OK
(myvenv) Yenlys-MacBook-Pro:django_girls yenlyma$ heroku run python manage.py createsuperuser
Running python manage.py createsuperuser on ⬢ ydgblog... up, run.4890 (Free)

You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, blog, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
    return super(Command, self).execute(*args, **options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 96, in handle
aniav commented 7 years ago

That should be fixed now, thank you for your work 🙏

zachsamuels commented 6 years ago

I am having the same issue. Traceback looks almost identical except for some line numbers. How did you fix this problem?

aniav commented 6 years ago

@CapnS we marged a fix that should have worked. But it was also a long time ago, so maybe something changed with heroku. I reopened it, but I don't expect to work on it any time soon, so try asking on Django Girls gitter channel 🙏

amakarudze commented 1 year ago

Closing this since we removed Heroku tutorial.