boxed / django-fastdev

An app to make it safer, faster and more fun to develop in Django
BSD 3-Clause "New" or "Revised" License
169 stars 14 forks source link

change: templates outside of project directory are ignored #34

Closed Naggafin closed 1 year ago

Naggafin commented 1 year ago

I love django-fastdev, but I think myself and many other devs have had a hassle with it flagging external templates. I wrote a small bit of code that will defer to django the error handling for templates outside of the base project directory. Should help a lot with third party django libraries which are noncompliant with how fastdev handles things.

boxed commented 1 year ago

Interesting idea. I like the simplicity of it!

I'm a bit worried that this can hide problems though. Maybe this could be a setting to flip it to the fully strict mode?

boxed commented 1 year ago

Hmm.. this won't work if the venv is inside the project directory though?

Naggafin commented 1 year ago

Good catch. I'm working on that now. I just made a commit, more as a checkpoint than anything else. I still need to test it. Stay tuned, I'll get something working to get around that.

Naggafin commented 1 year ago

Alrighty. Gave it a little bit of extra logic and it should work as intended now. Just tested it with both a venv environment and a global environment setup and both work. The logic is: 1) skip the django-fast test folder, 2) skip templates outside the project dir, 3) or if the template is inside the project dir, skip it if it is inside the venv directory. I also added a switch variable for strict template checking which can be added to the settings.py, forcing fastdev to check all templates regardless of origin. Hope this is a decent contribution!

boxed commented 1 year ago

I like it! Thanks!