Code

Opened 7 years ago

Closed 3 years ago

#6251 closed New feature (duplicate)

Allow rename of project directory

Reported by: Noam Raphael <spam.noam@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: lrekucki@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

Currently, a project directory can't be renamed. If I have created a site called "mysite", then it must live in a directory called "mysite". Renaming a project directory is useful if you want to keep a backup of a site, or to compare two versions - the easiest way is to copy "mysite" into "old_mysite", but the "old_mysite" doesn't work. Currently, I have to make a directory called "old" and copy "mysite" into it.

The attached simple patch solves this. It changes setup_environ() to check if a parameter called PROJECT_NAME is available in settings.py. If it is, the package is loaded by that name. If it isn't, the package is loaded by the directory name, just like it is now. It uses the imp.load_module function, so it doesn't have to append the parent directory to sys.path and then pop it.

Have a good day,
Noam

Attachments (1)

rename_project_dir.diff (2.4 KB) - added by Noam Raphael <spam.noam@…> 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Noam Raphael <spam.noam@…>

comment:1 Changed 7 years ago by Simon Greenhill <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 4 years ago by dgriffin

Three years old, but it still seems an excellent idea. I've come across situations where this is be an ideal solution.

comment:3 Changed 3 years ago by lrekucki

  • Cc lrekucki@… added

comment:4 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to New feature

comment:5 Changed 3 years ago by carljm

  • Easy pickings unset
  • Resolution set to duplicate
  • Status changed from new to closed
  • UI/UX unset

The root cause of this is #15372, manage.py adding the parent directory to sys.path. It shouldn't do that at all - adding a PROJECT_NAME setting is not a real solution. Marking duplicate.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.