How to migrate if the depth of the Django models folder is not common

Asked 2 years ago, Updated 2 years ago, 44 views

Hello, while trying to make a simple web game using django + javascript

I'm asking this question because I'm curious about route management.

web game project name is lucifer

├── lucifer
####Client Web Game Partial App Management #######
│   │   ├── game
│   │   │   ├── __init__.py
│   │   │   └── character
│   │   │   │   ├── __init__.py
│   │   │   │   └── models
│   │   │   │     ├── __init__.py
│   │   │   │     └── character.py
│   │   │   └── skill
│   │   │       ├── __init__.py
│   │   │       └── models
│   │   │           ├── __init__.py
│   │   │           └── skill.py
######################################
│   │   ├── lucifer
│   │   │   ├── __init__.py
│   │   │   ├── settings
│   │   │   ├── templates
│   │   │   ├── urls.py
│   │   │   ├── views
│   │   │   └── wsgi.py
│   │   ├── manage.py
################Web site part, app management#########################
│   │   ├── posts
│   │   │   ├── __init__.py
│   │   │   ├── models
│   │   │   │   ├── __init__.py
│   │   │   │   ├── comment.py
│   │   │   │   ├── freeboard.py
│   │   │   ├── templates
│   │   │   └── views
│   │   │       ├── __init__.py
│   │   │       └── freecreate.py
│   │   └── users
│       │       ├── __init__.py
│       │       ├── models
│       │       │   ├── __init__.py
│       │       │   └── user.py
│       │       ├── templates
│       │       └── views
#####################################

Logic tried to manage it this way.

Place the web site side in the normal django models path position.

The apps on the game side tried to be consistent by placing them in the sublogic of the folder /game/.

And use each __init__.py to make sure that all model.py (character, skill) is called properly Code added successfully.

And then we migrate, but only models of web site app were migrated, and models that existed in the game folder were not migrated.

I think app management is

lucifer , user, post, character, skill

The app is not located like this

lucifer , user, post, game(character, skill)

I think django can't find the models folder because it's written in .

I looked for some solutions, but I couldn't find a suitable effective way.

Please give me some advice.

python django

2022-09-22 20:08

1 Answers

It's a self-answer.

We solved it using AppConfig.


2022-09-22 20:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.