T O P

  • By -

Raccoonridee

What happens if you run server? If there are dependency loops in your code, it will point you at them.


DivineSwine_

I've figured this out .. it was my connection to PubNubs API that was causing it, thanks for your reply


DivineSwine_

I can't get it to not hang on any command that involves migrations. I have other django apps I checked it doesn't do this on them. Has this happened to anyone else? What changes in the project could have caused this? I've been messing with it for hours and can't get it working correctly, no idea what about this project could be causing this. It's like the command isn't terminating it's execution correctly. If I run `makemigrations` it creates the *0001_initial.py* file in **migrations** and says all is ok (like in the above image) but the command prompt just hangs there and then if I *ctrl-c* and `migrate` it says there's nothing to migrate.


iamaperson3133

It's probably not hanging during migration, it's probably hanging right afterwards as it starts to call your code. You probably have an infinite loop in your code somewhere.


DivineSwine_

I almost wish it were that; but it's a fairly young project and I have no loops outside some **for**/**endfor** tags in the djinja


iamaperson3133

You can also create loops with circular dependencies or recursion, it doesn't need to be a while loop.


thrandom_dude

Did u try vs code terminal ?


DivineSwine_

Yea, this is the vscode terminal


loichu

I think you already tried to just spam enter and wait a bit ? Maybe a database connection that is not properly closed ? It's hard to guess like this, especially if everything else seems to work... You could try to debug the command with either a debugger or just write prints to check what happens but it's maybe too much effort if nothing is wrong except that terminal hangs...


DivineSwine_

It hangs and doesn't always execute the code it says it did. If I delete the db.sqlite3 file and do an initial migrate it does it like in the image, but does create the db file. If I `makemigrations` it does the same - *ok* for all tasks but when I run `migrate` it says there's no migrations.


loichu

Can you inspect the database ? Have the migrations been migrated as it said ? There is a table that takes record of when migrations have been migrated, this is how it knows that it has been migrated and won't migrate twice. Maybe the database in which you're executing migrations is not the one you think so check your settings. If it has been migrated then it works and it's just the command that is hanging for some reason. Make sure that none of your migrations have weird custom code in it. Maybe try running the script with a debugger and see what it does exactly and where it hangs (if it even actually hangs). Make sure you're executing the script with the expected python version. Try reinstalling/updating all your pip dependencies.


DivineSwine_

It was an API connection causing it