Having permission problems while trying to create pdf file on Apache Server using Django Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Having Django serve downloadable filesdjango/apache permissions problemDjango file upload: permission problem, error 13Error message “Forbidden You don't have permission to access / on this server”Changing file permissions for Apache - DjangoDjango OSError - [Errno 13] Permission denied: '/media/images' - are my MEDIA_URL and MEDIA_ROOT settings bad?Linux - Difference between transferring files and creating them - PermissionsHow to set standard PHP user permissions?User input to reference file doesn't work on Apache serverDjango apache localhost permissions problem
Why datecode is SO IMPORTANT to chip manufacturers?
Sally's older brother
How much damage would a cupful of neutron star matter do to the Earth?
Flight departed from the gate 5 min before scheduled departure time. Refund options
White walkers, cemeteries and wights
AppleTVs create a chatty alternate WiFi network
What initially awakened the Balrog?
What is the difference between a "ranged attack" and a "ranged weapon attack"?
Asymptotics question
How can I save and copy a screenhot at the same time?
I can't produce songs
Are the endpoints of the domain of a function counted as critical points?
Did any compiler fully use 80-bit floating point?
Does the Black Tentacles spell do damage twice at the start of turn to an already restrained creature?
A proverb that is used to imply that you have unexpectedly faced a big problem
Can an iPhone 7 be made to function as a NFC Tag?
Is there hard evidence that the grant peer review system performs significantly better than random?
what is the log of the PDF for a Normal Distribution?
Project Euler #1 in C++
Universal covering space of the real projective line?
New Order #6: Easter Egg
Why is std::move not [[nodiscard]] in C++20?
Google .dev domain strangely redirects to https
Mounting TV on a weird wall that has some material between the drywall and stud
Having permission problems while trying to create pdf file on Apache Server using Django
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Having Django serve downloadable filesdjango/apache permissions problemDjango file upload: permission problem, error 13Error message “Forbidden You don't have permission to access / on this server”Changing file permissions for Apache - DjangoDjango OSError - [Errno 13] Permission denied: '/media/images' - are my MEDIA_URL and MEDIA_ROOT settings bad?Linux - Difference between transferring files and creating them - PermissionsHow to set standard PHP user permissions?User input to reference file doesn't work on Apache serverDjango apache localhost permissions problem
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a problem with deployment of my web app.
I am using Django 2.1.7 on apache2.
I set all the proper permissions to folders and files (at least thats what I think):
drwxr-s--- 10 bedirt www-data 4096 Mar 8 21:10 projectNal
And in the folder:
-rwxr-x--- 1 bedirt www-data 11357 Mar 2 20:37 LICENSE
-rwxr-x--- 1 bedirt www-data 12 Mar 2 20:37 README.md
drwxr-x--- 4 bedirt www-data 4096 Mar 2 20:42 addQuestion
-rwxrwx--- 1 bedirt www-data 536576 Mar 2 21:51 db.sqlite3
-rwxr-x--- 1 bedirt www-data 542 Mar 2 20:37 manage.py
drwxrwx--- 2 bedirt www-data 4096 Mar 8 21:10 media
drwxr-x--- 3 bedirt www-data 4096 Mar 8 21:53 projectNal
drwxr-x--- 6 bedirt www-data 4096 Mar 8 22:49 qBank
-rwxr-x--- 1 bedirt www-data 512 Mar 2 20:37 requirements.txt
drwxr-x--- 12 bedirt www-data 4096 Mar 2 20:37 static
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 users
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 venv
I am using pylatex to create a latex document, the procedure is - it runs latex compilation and removes the .tex file, and uploads the pdf on media folder.
Here is the code:
Output_tex.py
def create_worksheet_pdf(data, title):
# Document with `maketitle` command activated
doc = Document(default_filepath='../media/', documentclass='exam')
# Title part
doc.preamble.append(Command('headrule'))
doc.preamble.append(Command('chead', '?'))
doc.preamble.append(Command('lhead', '?'))
doc.preamble.append(Command('rhead', '?'))
# questions
with doc.create(Section(title)):
doc.append(Command('begin', 'questions'))
for row in data:
questionHead = r'question (' + row.year + '-' + row.source + '-' + row.problemNumber + ')\\'
doc.append(NoEscape(questionHead))
doc.append(NoEscape(r"" + row.problemStatement))
doc.append(Command('end', 'questions'))
# questions end
# end
doc.generate_pdf(filepath='media/'+title, clean_tex=True)
The filepath
parts might be important in this file, so I couldn't use MEDIA_ROOT or MEDIA_URL since I get error. As can be seen on the permission I gave write access to apache (www-data) for both media and the db. My media files etc works fine on local, but I just uploaded to server and now i cant figure out why it is not working.
The error is:
PermissionError at /output/
[Errno 13] Permission denied: 'Momentum-Questions.tex'
And I did configure MEDIA_ROOT
and MEDIA_URL
, here it is:
Settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
- Everything was working fine up until I added the craeting pdf part. So My conf file and stuff are fine, if there is nothing else is needs to added.
python django apache
add a comment |
I have a problem with deployment of my web app.
I am using Django 2.1.7 on apache2.
I set all the proper permissions to folders and files (at least thats what I think):
drwxr-s--- 10 bedirt www-data 4096 Mar 8 21:10 projectNal
And in the folder:
-rwxr-x--- 1 bedirt www-data 11357 Mar 2 20:37 LICENSE
-rwxr-x--- 1 bedirt www-data 12 Mar 2 20:37 README.md
drwxr-x--- 4 bedirt www-data 4096 Mar 2 20:42 addQuestion
-rwxrwx--- 1 bedirt www-data 536576 Mar 2 21:51 db.sqlite3
-rwxr-x--- 1 bedirt www-data 542 Mar 2 20:37 manage.py
drwxrwx--- 2 bedirt www-data 4096 Mar 8 21:10 media
drwxr-x--- 3 bedirt www-data 4096 Mar 8 21:53 projectNal
drwxr-x--- 6 bedirt www-data 4096 Mar 8 22:49 qBank
-rwxr-x--- 1 bedirt www-data 512 Mar 2 20:37 requirements.txt
drwxr-x--- 12 bedirt www-data 4096 Mar 2 20:37 static
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 users
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 venv
I am using pylatex to create a latex document, the procedure is - it runs latex compilation and removes the .tex file, and uploads the pdf on media folder.
Here is the code:
Output_tex.py
def create_worksheet_pdf(data, title):
# Document with `maketitle` command activated
doc = Document(default_filepath='../media/', documentclass='exam')
# Title part
doc.preamble.append(Command('headrule'))
doc.preamble.append(Command('chead', '?'))
doc.preamble.append(Command('lhead', '?'))
doc.preamble.append(Command('rhead', '?'))
# questions
with doc.create(Section(title)):
doc.append(Command('begin', 'questions'))
for row in data:
questionHead = r'question (' + row.year + '-' + row.source + '-' + row.problemNumber + ')\\'
doc.append(NoEscape(questionHead))
doc.append(NoEscape(r"" + row.problemStatement))
doc.append(Command('end', 'questions'))
# questions end
# end
doc.generate_pdf(filepath='media/'+title, clean_tex=True)
The filepath
parts might be important in this file, so I couldn't use MEDIA_ROOT or MEDIA_URL since I get error. As can be seen on the permission I gave write access to apache (www-data) for both media and the db. My media files etc works fine on local, but I just uploaded to server and now i cant figure out why it is not working.
The error is:
PermissionError at /output/
[Errno 13] Permission denied: 'Momentum-Questions.tex'
And I did configure MEDIA_ROOT
and MEDIA_URL
, here it is:
Settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
- Everything was working fine up until I added the craeting pdf part. So My conf file and stuff are fine, if there is nothing else is needs to added.
python django apache
Even if I give full permission and ownership to www-data I still get the same error...
– drMoon
Mar 8 at 23:48
Use absolute paths bases on the constants from the settings:os.path.join(settings.MEDIA_ROOT, title)
– Klaus D.
Mar 9 at 1:15
maan thats it :) thank you @KlausD.
– drMoon
Mar 9 at 1:44
add a comment |
I have a problem with deployment of my web app.
I am using Django 2.1.7 on apache2.
I set all the proper permissions to folders and files (at least thats what I think):
drwxr-s--- 10 bedirt www-data 4096 Mar 8 21:10 projectNal
And in the folder:
-rwxr-x--- 1 bedirt www-data 11357 Mar 2 20:37 LICENSE
-rwxr-x--- 1 bedirt www-data 12 Mar 2 20:37 README.md
drwxr-x--- 4 bedirt www-data 4096 Mar 2 20:42 addQuestion
-rwxrwx--- 1 bedirt www-data 536576 Mar 2 21:51 db.sqlite3
-rwxr-x--- 1 bedirt www-data 542 Mar 2 20:37 manage.py
drwxrwx--- 2 bedirt www-data 4096 Mar 8 21:10 media
drwxr-x--- 3 bedirt www-data 4096 Mar 8 21:53 projectNal
drwxr-x--- 6 bedirt www-data 4096 Mar 8 22:49 qBank
-rwxr-x--- 1 bedirt www-data 512 Mar 2 20:37 requirements.txt
drwxr-x--- 12 bedirt www-data 4096 Mar 2 20:37 static
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 users
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 venv
I am using pylatex to create a latex document, the procedure is - it runs latex compilation and removes the .tex file, and uploads the pdf on media folder.
Here is the code:
Output_tex.py
def create_worksheet_pdf(data, title):
# Document with `maketitle` command activated
doc = Document(default_filepath='../media/', documentclass='exam')
# Title part
doc.preamble.append(Command('headrule'))
doc.preamble.append(Command('chead', '?'))
doc.preamble.append(Command('lhead', '?'))
doc.preamble.append(Command('rhead', '?'))
# questions
with doc.create(Section(title)):
doc.append(Command('begin', 'questions'))
for row in data:
questionHead = r'question (' + row.year + '-' + row.source + '-' + row.problemNumber + ')\\'
doc.append(NoEscape(questionHead))
doc.append(NoEscape(r"" + row.problemStatement))
doc.append(Command('end', 'questions'))
# questions end
# end
doc.generate_pdf(filepath='media/'+title, clean_tex=True)
The filepath
parts might be important in this file, so I couldn't use MEDIA_ROOT or MEDIA_URL since I get error. As can be seen on the permission I gave write access to apache (www-data) for both media and the db. My media files etc works fine on local, but I just uploaded to server and now i cant figure out why it is not working.
The error is:
PermissionError at /output/
[Errno 13] Permission denied: 'Momentum-Questions.tex'
And I did configure MEDIA_ROOT
and MEDIA_URL
, here it is:
Settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
- Everything was working fine up until I added the craeting pdf part. So My conf file and stuff are fine, if there is nothing else is needs to added.
python django apache
I have a problem with deployment of my web app.
I am using Django 2.1.7 on apache2.
I set all the proper permissions to folders and files (at least thats what I think):
drwxr-s--- 10 bedirt www-data 4096 Mar 8 21:10 projectNal
And in the folder:
-rwxr-x--- 1 bedirt www-data 11357 Mar 2 20:37 LICENSE
-rwxr-x--- 1 bedirt www-data 12 Mar 2 20:37 README.md
drwxr-x--- 4 bedirt www-data 4096 Mar 2 20:42 addQuestion
-rwxrwx--- 1 bedirt www-data 536576 Mar 2 21:51 db.sqlite3
-rwxr-x--- 1 bedirt www-data 542 Mar 2 20:37 manage.py
drwxrwx--- 2 bedirt www-data 4096 Mar 8 21:10 media
drwxr-x--- 3 bedirt www-data 4096 Mar 8 21:53 projectNal
drwxr-x--- 6 bedirt www-data 4096 Mar 8 22:49 qBank
-rwxr-x--- 1 bedirt www-data 512 Mar 2 20:37 requirements.txt
drwxr-x--- 12 bedirt www-data 4096 Mar 2 20:37 static
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 users
drwxr-x--- 5 bedirt www-data 4096 Mar 2 20:37 venv
I am using pylatex to create a latex document, the procedure is - it runs latex compilation and removes the .tex file, and uploads the pdf on media folder.
Here is the code:
Output_tex.py
def create_worksheet_pdf(data, title):
# Document with `maketitle` command activated
doc = Document(default_filepath='../media/', documentclass='exam')
# Title part
doc.preamble.append(Command('headrule'))
doc.preamble.append(Command('chead', '?'))
doc.preamble.append(Command('lhead', '?'))
doc.preamble.append(Command('rhead', '?'))
# questions
with doc.create(Section(title)):
doc.append(Command('begin', 'questions'))
for row in data:
questionHead = r'question (' + row.year + '-' + row.source + '-' + row.problemNumber + ')\\'
doc.append(NoEscape(questionHead))
doc.append(NoEscape(r"" + row.problemStatement))
doc.append(Command('end', 'questions'))
# questions end
# end
doc.generate_pdf(filepath='media/'+title, clean_tex=True)
The filepath
parts might be important in this file, so I couldn't use MEDIA_ROOT or MEDIA_URL since I get error. As can be seen on the permission I gave write access to apache (www-data) for both media and the db. My media files etc works fine on local, but I just uploaded to server and now i cant figure out why it is not working.
The error is:
PermissionError at /output/
[Errno 13] Permission denied: 'Momentum-Questions.tex'
And I did configure MEDIA_ROOT
and MEDIA_URL
, here it is:
Settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
- Everything was working fine up until I added the craeting pdf part. So My conf file and stuff are fine, if there is nothing else is needs to added.
python django apache
python django apache
edited Mar 8 at 23:26
drMoon
asked Mar 8 at 23:14
drMoondrMoon
13
13
Even if I give full permission and ownership to www-data I still get the same error...
– drMoon
Mar 8 at 23:48
Use absolute paths bases on the constants from the settings:os.path.join(settings.MEDIA_ROOT, title)
– Klaus D.
Mar 9 at 1:15
maan thats it :) thank you @KlausD.
– drMoon
Mar 9 at 1:44
add a comment |
Even if I give full permission and ownership to www-data I still get the same error...
– drMoon
Mar 8 at 23:48
Use absolute paths bases on the constants from the settings:os.path.join(settings.MEDIA_ROOT, title)
– Klaus D.
Mar 9 at 1:15
maan thats it :) thank you @KlausD.
– drMoon
Mar 9 at 1:44
Even if I give full permission and ownership to www-data I still get the same error...
– drMoon
Mar 8 at 23:48
Even if I give full permission and ownership to www-data I still get the same error...
– drMoon
Mar 8 at 23:48
Use absolute paths bases on the constants from the settings:
os.path.join(settings.MEDIA_ROOT, title)
– Klaus D.
Mar 9 at 1:15
Use absolute paths bases on the constants from the settings:
os.path.join(settings.MEDIA_ROOT, title)
– Klaus D.
Mar 9 at 1:15
maan thats it :) thank you @KlausD.
– drMoon
Mar 9 at 1:44
maan thats it :) thank you @KlausD.
– drMoon
Mar 9 at 1:44
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072294%2fhaving-permission-problems-while-trying-to-create-pdf-file-on-apache-server-usin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072294%2fhaving-permission-problems-while-trying-to-create-pdf-file-on-apache-server-usin%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Even if I give full permission and ownership to www-data I still get the same error...
– drMoon
Mar 8 at 23:48
Use absolute paths bases on the constants from the settings:
os.path.join(settings.MEDIA_ROOT, title)
– Klaus D.
Mar 9 at 1:15
maan thats it :) thank you @KlausD.
– drMoon
Mar 9 at 1:44