On 7/11/2022 2:40 am, Nick Chang wrote:
Hello community,

I am trying to organize my Django project's structure as the number of apps is growing. So I am attempting to move an app in the sub-folder that contains its model definitions. The app used to be named `<sub_folder_name>.foo <http://sub_folder_name%3E.foo/>` and now it will be just named `foo` in the `LOCAL_APPS` setting.

It seems straightforward to do this with the following two steps:

 1. Change the reference from `<sub_folder_name>.foo
    <http://sub_folder_name%3E.foo/>` to `foo` in the whole project.
 2. Do `mv foo ..` inside the sub-folder.

Is there any DB migration work that this move requires? Or since the app name stays the same. There is nothing that needs to be done as Django does not see any change in the models. So far my investigation confirms no DB migration work is needed but would like to hear some experiences that folks might have done before.

Should work just fine.

In any case, you can also specify the table name the model should use if you do decide to switch models between apps ...

    class Meta:
         app_label = "company"
         db_table = "common_user"

If your python code works and your tests pass everything should be fine.



Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com <https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d753d252-2ff7-4138-e301-99beb9132066%40dewhirst.com.au.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to