You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, after a few hours I noticed that even if were adding the package 'test_app', not all of its contents were going into the lib folder.
I'm now using this in my setup.py to get all the contents of a list of main folders that are part of a django project:
def get_py_files(directories):
py_files = []
for directory in directories:
for root, dirs, files in os.walk(directory):
for file in files:
if file.endswith('.py'):
relative_root = root.replace(directory, '').lstrip(os.sep)
dotted_path = relative_root.replace(os.sep, '.')
if dotted_path:
py_files.append(f"{directory}.{dotted_path}.{file[:-3]}")
else:
py_files.append(f"{directory}.{file[:-3]}")
return py_files
Probably not the cleanest way, but it works and auto detects the command without the previous solution I did before.
Describe the bug
When adding a Django custom admin command, it wont show or run by default when app is packaged.
To Reproduce
Start a basic boilerplate django app, then add a command:
https://docs.djangoproject.com/en/4.2/howto/custom-management-commands/
Expected behavior
After using setup.py build, should be able to run exename.exe custom_command
Desktop (please complete the following information):
Additional context
I got it working by monkey patching this by importing this on my manage.py script.
And making sure that setup.py has the command.py file in its build_options:
Hope it helps :]
The text was updated successfully, but these errors were encountered: