question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_directories in staticfiles.py has bad asserts

See original GitHub issue

I don’t think you can use F-Strings in assert statements. I get “invalid syntax” if I try.

The line: directory = os.path.normpath(os.path.join(spec.origin, "..", "statics")) Always assumes there is a folder statics? I believe the standard is static and not statics and the user is not given the option to circumvent the step. Does it make more sense to only include this step if directory is None.

The directory argument does not get the package path prepended, which I feel is implied in the documentation.

The assert os.path.isdir(directory) will fail every time since it will return the __init__.py of a package.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tomchristiecommented, Jul 15, 2019

Closed via #535 and released as 0.12.3.

Happy to also resconsider our static dir naming, but let’s treat that as a sperate issue if anyone wants to open it.

1reaction
dmontagucommented, Jun 11, 2019

@tomchristie this page of the Django docs says:

Files are searched by using the enabled finders. The default is to look in all locations defined in STATICFILES_DIRS and in the ‘static’ directory of apps specified by the INSTALLED_APPS setting.

I believe this is reflected in the code here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why won't collectstatic copy my static files? - Stack Overflow
When I run ./manage.py collectstatic , I expect the MyApp directory be copied to STATIC_ROOT , but it doesn't. I have DownloadedApp/static/ ...
Read more >
How to manage static files (e.g. images, JavaScript, CSS)
This method is grossly inefficient and probably insecure, so it is unsuitable for production. See How to deploy static files for proper strategies...
Read more >
error while running '$ python manage.py collectstatic --noinput ...
The absolute path to the directory where collectstatic will collect static files for deployment. Something like this should work:.
Read more >
Whta is the point of the /static/ directory? (Example) - Treehouse
/staticfiles.py is the name of the file where the loaded "static" method lives. Prior to Django 2.0 we had to explicitly tell the...
Read more >
Nixpkgs 22.11 manual - NixOS
Nix expressions describe how to build packages from source and are collected in the nixpkgs repository. Also included in the collection are Nix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found