1👍
Your source file is located in \\10.8.0.1\share\djprj\djprj\djprj\egais\
, that means line:
MYDIR = os.path.dirname(__file__)
will store that path in MYDIR
variable, but your file is located in different directory. First, try to use:
MYDIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
that will give you path \\10.8.0.1\share\djprj\djprj\
. Now, you should add one more /static
to line:
with open(os.path.join(MYDIR, '/static/egais_files/client.xml'), 'w') as f:
so it will look like:
with open(os.path.join(MYDIR, '/static/static/egais_files/client.xml'), 'w') as f:
And it should give proper file path.
0👍
Unless the file containing some_view is located in \\10.8.0.1\share\djprj\djprj\static\
you’re not giving the right path. I suspect it is in \\10.8.0.1\share\djprj\djprj\
meaning you need to add ‘/static/’ to the path.
- How to save user from non class based view in django?
- ID Attribute Error Django Admin in Change Form
Source:stackexchange.com