Quantcast
Channel: Relative Imports in Django - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Antony Hatchkins for Relative Imports in Django

If test is another app,from .other import samplewont work.Update:You can only use relative imports when you're importing from the same app.Inside test appfrom .other import samplewill work. But you'll...

View Article



Answer by Crazyshezy for Relative Imports in Django

I usually use imports like this only for one reason from .foo import barfrom .other import sampleThe reason being If Tomorrow, my module name changes from say 'test' to 'mytest' then the code does not...

View Article

Relative Imports in Django

I'm reading Two Scoops Django Best Practices to make my coding style improve. I'm in relative imports and here is the sample code to make it reusable.Old Way:from cones.foo import barNew way:from .foo...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images