9

I'm trying to deploy a Django (1.8) app to Heroku, runtime Python 3.4.2. The app runs succesfully (except the fact that tables are not created), but when trying run the syncdb I get the following error:

Running `python manage.py syncdb` attached to terminal... up, run.5851
/app/.heroku/python/lib/python3.4/site-packages/django/core/management       
/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command 
will be removed in Django 1.9
warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/migrations/loader.py", line 157, in check_key
return list(self.graph.root_nodes(key[0]))[0]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.4/site-packages/django /core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
call_command("migrate", **options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 93, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/migrations/executor.py", line 19, in __init__
self.loader = MigrationLoader(self.connection)
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/migrations/loader.py", line 47, in __init__
self.build_graph()
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/migrations/loader.py", line 287, in build_graph
parent = self.check_key(parent, key[0])
File "/app/.heroku/python/lib/python3.4/site-packages/django/db/migrations/loader.py", line 164, in check_key
raise ValueError("Dependency on app with no migrations: %s" % key[0])
ValueError: Dependency on app with no migrations: authentication

I'm using sqlite.

user3706162
  • 127
  • 3
  • 6

3 Answers3

9

On your dev machine, create your migrations with python manage.py makemigrations. Then, assuming your migrations folders are pushed to heroku, on heroku run python manage.py migrate instead of python manage.py syncdb. See the docs.

mcastle
  • 2,882
  • 3
  • 25
  • 43
  • I am having the same problem. What do I do with migrations for django apps that are in my virtualenv? Maybe that's not my problem anyway, I'm not sure. – northben Jun 22 '15 at 03:52
  • 2
    Try heroku run python manage.py migrate. This will migrate the apps in your production machine's virtualenv. – mcastle Jun 22 '15 at 04:46
7

I hade to enter the heroku's machine bash :

heroku run bash

and then make the makemigrations:

heroku run python manage.py makemigrations

Finally,

heroku run python manage.py migrate
Alvaro Silvino
  • 9,441
  • 12
  • 52
  • 80
2

For me i solved this issue by using same command what we use in our local server with prefix "heroku run" that's it..

for eg:-

python manage.py makemigrations 

it will work in our local but for heroku, like this :-

heroku run python manage.py makemigrations
Mohideen bin Mohammed
  • 18,813
  • 10
  • 112
  • 118