Django: Moving 'oscar' site-package

195 Views Asked by At

I am starting my own Django-Oscar project, and am wondering about the possibility of changing the location of the 'oscar'-directory (containing all apps, a models.py etc), moving it from the default on-installation site-packages directory within my virtual environment - into my project root directory.

Would it be possible to simply copy the 'oscar'-directory, and paste it into a new location, assuming I also change the locations of the 'INSTALLED_APPS', and make sure that my project-structure is the same (i.e. not changing things like the directory-name 'oscar' so that imports etc break)? If so, would that mean that I could delete it all together from site-packages (DRY-solution)?

This would mimic the sandbox-installation, and would be a set up I'd feel more comfortable with as a beginner who needs visible overhead.

Thank you!

1

There are 1 best solutions below

5
On BEST ANSWER

Yes, you can do that. Although, it's not recommended, because then it'd be harder for you to incorporate latest oscar changes into your project, and it's not the recommended way to customize / extend oscar functionality.

Instead of deleting oscar from site-packages you should rather pip uninstall django-oscar.

Also, it's possible to have oscar installed, as well as copied into your project directory at the same time. By Python defaults, the one in your project directory would be the one that will get imported (instead of the installed). This way, you can have the comfort of working with it locally. I sometimes do this so that I can safely test certain django apps (like oscar) with minor changes (in development environment), but not having to commit / push these changes into a production environment mostly because it's easier this way than following recommended methods to extend the app.