Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
Django initial data for built-in app

I'm starting to use the "redirects" app built into Django to replace some existing redirects I have in my urls.py. I was wondering if there was any generally accepted way to include initial data in the code base for other apps. For example, if it was for an app I created I could create a migration file that had a RunPython section where I could load some initial data. With a built-in or third-party app there doesn't seem to be any way to create a migration file to add initial data.

The best I can think of right now is to include a .sql file in my repository with the initial data and just manually import the data as I push the code to the different instances.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

you can do it by using fixtures

create a folder name fixtures in your app directory

use this command to create a json file that you want to make as initial data.

 python manage.py dumpdata you_app_name.model_name --indent 2 > model_name.json

copy this model_name.json to fixtures folder.

upload the code to the repo.

then after the migrate command . Type this command to load the initial data.

  python manage.py loaddata model_name.json

reference

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda