Great post! But I have a doubt. Why do you just put the filename directly? Currently you call the app config path name, management and command folders append to filename.
@marlysson
, I have kept the files in the same directory of where I put the custom command. I suppose it is good practice to import data files in this way. Have you tried using the filename directly?
Yes, I do.
Was because instead get current directory and join with filename, you got the app name and join with many folders and after that join with filename to build the complete path to file.
I just got this doubt, but this article was very useful to me.
@marlysson
, glad the tutorial helped you. FYI, I have added Django Custom Command in Django Docs Example Polls Application in this Github code repository: github.com/arsho/django-custom-com...
Stay safe! :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great post! But I have a doubt. Why do you just put the filename directly? Currently you call the app config path name, management and command folders append to filename.
Thanks.
@marlysson , I have kept the files in the same directory of where I put the custom command. I suppose it is good practice to import data files in this way. Have you tried using the filename directly?
Thank you.
Shovon
Yes, I do.
Was because instead get current directory and join with filename, you got the app name and join with many folders and after that join with filename to build the complete path to file.
I just got this doubt, but this article was very useful to me.
@marlysson , glad the tutorial helped you. FYI, I have added Django Custom Command in Django Docs Example Polls Application in this Github code repository: github.com/arsho/django-custom-com...
Stay safe! :)