Skip to content

Instantly share code, notes, and snippets.

@newbrunomartins
Created December 27, 2018 23:27
Show Gist options
  • Save newbrunomartins/4d8e46502ff0165afe006fb4298c83ad to your computer and use it in GitHub Desktop.
Save newbrunomartins/4d8e46502ff0165afe006fb4298c83ad to your computer and use it in GitHub Desktop.
Deu Ruim no Python/Django, talvez estes comando ajudem!
As vezes vai dar ruim nas migrations ou alguma treta que você não vai saber como resolver ou porque você já esta puto demais
pra continuar procurando...
Pensando nisso, segue a solução tabajara!
#Removendo as migrations com "segurança" (rsrs, rm -rf nunca é de verdade ó.Ò):
rm -rf <app>/migrations/
#Redefinindo as migrações, ou tentando rsrs
python manage.py migrate --fake
#Criando as migrações iniciais. CALMA! as migrações dos models já irão acontecer ;)
python manage.py makemigrations <app> .
#Se quiser mandar umas migrações fake, manda ver com o código abaixo! Ah! Ele também vai mandar ver nas migrations dos models
python manage.py migrate --fake-initial
#Seja feliz! Tu resetou a bagaça toda!!!
#Que?! Deu ruim no admin do Django? Não temas jovem gafanhoto! Manda o comando abaixo e segue o fluxo ;)
python manage.py createsuperuser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment