Proposal for Adding Renaming Functionality to Django Projects and Apps

Hello, Django community,

I’d like to initiate a discussion about the possibility of adding a renaming functionality to Django for both projects and apps. This feature could make it easier for developers, especially in large-scale applications, to manage naming changes without manual updates and potential issues.

Key Points for Discussion

  1. Renaming Command: I propose adding a new command, possibly named rename, to Django. The basic usage could be as follows:
python rename currentname changedname
  1. Avoid Hardcoding Names: Currently, Django applications and project names are often hardcoded in various places. We believe it’s essential to move away from this practice to facilitate renaming.

  2. User-Friendly: The primary aim of this feature is to simplify the renaming process for developers. The command should be intuitive and straightforward to use.

  3. Community Input: I encourage community members to share their thoughts, experiences, and use cases related to renaming projects and apps. Your feedback is vital in shaping this feature.

  4. Implementation: While this is an initial discussion, we recognize that the implementation details will need further exploration and development.

Please share your thoughts, ideas, and any challenges you’ve faced when renaming Django projects or apps. Your input will help us gauge the interest and potential benefits of this feature.

Let’s work together to make Django even more developer-friendly and adaptable for various project scenarios.

Thank you for your participation!

Feel free to customize and expand upon this message as needed. This should serve as a starting point for your discussion on the Django community forum.

ChatGPT aside…

Feel free to customize and expand upon this message as needed. This should serve as a starting point for your discussion on the Django community forum.

What benefits do you expect to see with enabling an easy rename feature?

It’s not just the directory and some code. The app name gets embedded by default in database table names as a form of namespacing, It ends up as values in the ContentType model.

Is the goal to automate all of the above (directory rename, update code, generate migrations, etc) to some extent?

If so then I would suggest starting a third-party package that would perform the necessary steps and see if that gains traction first. However, I imagine that the package would make a fair few assumptions about particular projects and so would not be as simple as you imagine.

I don’t name any folder after the project name. Thus i don’t need rename anything inside project, just rename the base directory.

I have built my own boilerplate. Let me know what do you guys think about this.

Thank you for replying nanorepublica,

I believe name shouldn’t be hardcoded, at least in the codebase if so it will make it easier to rename.

even if names are embedded in the database few migrations will help to rename it.

as you suggested idea of a third-party package is not simple to implement. package will need a few assumptions, if there are few customizations in the project, the package might not work, hence it should be a core functionality that can handle all the cases.

My point with mentioning a third-party package is that would provide proof that a core solution is firstly possible and secondly desirable by the community at large.

I would suggest that you do some research as to which situations the names that you don’t want hard coded crop up and then propose how you deal with these scenarios in turn.

These alternatives could then be implemented in a third-party package as a proof of concept for your idea.

1 Like

Got your point I will try to implement it.