<bdo id='JaGbK'></bdo><ul id='JaGbK'></ul>
  • <legend id='JaGbK'><style id='JaGbK'><dir id='JaGbK'><q id='JaGbK'></q></dir></style></legend>
  • <small id='JaGbK'></small><noframes id='JaGbK'>

      <tfoot id='JaGbK'></tfoot>
      1. <i id='JaGbK'><tr id='JaGbK'><dt id='JaGbK'><q id='JaGbK'><span id='JaGbK'><b id='JaGbK'><form id='JaGbK'><ins id='JaGbK'></ins><ul id='JaGbK'></ul><sub id='JaGbK'></sub></form><legend id='JaGbK'></legend><bdo id='JaGbK'><pre id='JaGbK'><center id='JaGbK'></center></pre></bdo></b><th id='JaGbK'></th></span></q></dt></tr></i><div id='JaGbK'><tfoot id='JaGbK'></tfoot><dl id='JaGbK'><fieldset id='JaGbK'></fieldset></dl></div>

        PermissionError:[Errno 13] 权限被拒绝:'/manage.py'

        PermissionError: [Errno 13] Permission denied: #39;/manage.py#39;(PermissionError:[Errno 13] 权限被拒绝:/manage.py)
          <bdo id='imRFl'></bdo><ul id='imRFl'></ul>

            <legend id='imRFl'><style id='imRFl'><dir id='imRFl'><q id='imRFl'></q></dir></style></legend>

            <small id='imRFl'></small><noframes id='imRFl'>

            <i id='imRFl'><tr id='imRFl'><dt id='imRFl'><q id='imRFl'><span id='imRFl'><b id='imRFl'><form id='imRFl'><ins id='imRFl'></ins><ul id='imRFl'></ul><sub id='imRFl'></sub></form><legend id='imRFl'></legend><bdo id='imRFl'><pre id='imRFl'><center id='imRFl'></center></pre></bdo></b><th id='imRFl'></th></span></q></dt></tr></i><div id='imRFl'><tfoot id='imRFl'></tfoot><dl id='imRFl'><fieldset id='imRFl'></fieldset></dl></div>
            <tfoot id='imRFl'></tfoot>
                <tbody id='imRFl'></tbody>

                  本文介绍了PermissionError:[Errno 13] 权限被拒绝:'/manage.py'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在 docker-composer 中运行以下命令,以使用 django-admin 启动项目:

                  I am trying to run the following command in docker-composer, to start project with django-admin:

                  docker-compose run app sh -c "django-admin startproject app ."
                  

                  这会产生错误:

                      Traceback (most recent call last):
                    File "/usr/local/bin/django-admin", line 10, in <module>
                      sys.exit(execute_from_command_line())
                    File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
                      utility.execute()
                    File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
                      self.fetch_command(subcommand).run_from_argv(self.argv)
                    File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
                      self.execute(*args, **cmd_options)
                    File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
                      output = self.handle(*args, **options)
                    File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/startproject.py", line 20, in handle
                      super().handle('project', project_name, target, **options)
                    File "/usr/local/lib/python3.7/site-packages/django/core/management/templates.py", line 155, in handle
                      with open(new_path, 'w', encoding='utf-8') as new_file:
                  PermissionError: [Errno 13] Permission denied: '/manage.py'
                  

                  Dockerfile如下:

                  The Dockerfile is as follows:

                  FROM python:3.7-alpine
                  MAINTAINER anubrij chandra
                  
                  ENV PYTHONUNBUFFERED 1
                  
                  COPY ./requirements.txt /requirements.txt
                  
                  RUN pip install -r /requirements.txt
                  
                  RUN mkdir /app
                  COPY ./app /app
                  
                  
                  
                  RUN adduser -D dockuser
                  USER dockuser
                  

                  我的docker-compose.yml:

                  version: "3"
                  
                  services:
                    app:
                      build:
                        context: .
                      ports:
                        - "8000:8000"
                      volumes:
                        - ./app:/app
                      command: >
                        sh -c "python manage.py runserver 0.0.0.0:8000"
                  

                  我应用了 这个 Stack Overflow 线程,但它没有工作.

                  I applied the solution suggested in this Stack Overflow thread, but it didn't work.

                  我使用的是 Ubuntu 18.04.

                  I'm using Ubuntu 18.04.

                  推荐答案

                  在你的 dockerfile 中,你指向一个新用户 dockuser.

                  In your dockerfile, you are pointing to a new user dockuser.

                  RUN adduser -D dockuser
                  USER dockuser
                  

                  因此,您的容器将以用户 dockuser 开始,该用户似乎没有适当的权限来运行 /manage.py.

                  Hence your container will start with user dockuser which don't seems to have proper permissions to run /manage.py.

                  你可以

                  • 删除上面提到的您创建并指向的行dockuser.

                  • 在/manage.py 文件的 dockerfile 中使用 chownchmod 命令为用户 dockuser 提供适当的权限.
                  • provide appropriate permission to user dockuser using chown and chmod commands in your dockerfile for /manage.py file.

                  我已经回答了类似的问题这里.

                  I have answered such similar question here.

                  这篇关于PermissionError:[Errno 13] 权限被拒绝:'/manage.py'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                  1. <small id='M6RrN'></small><noframes id='M6RrN'>

                      <tbody id='M6RrN'></tbody>
                    <tfoot id='M6RrN'></tfoot>

                        <legend id='M6RrN'><style id='M6RrN'><dir id='M6RrN'><q id='M6RrN'></q></dir></style></legend>

                      • <i id='M6RrN'><tr id='M6RrN'><dt id='M6RrN'><q id='M6RrN'><span id='M6RrN'><b id='M6RrN'><form id='M6RrN'><ins id='M6RrN'></ins><ul id='M6RrN'></ul><sub id='M6RrN'></sub></form><legend id='M6RrN'></legend><bdo id='M6RrN'><pre id='M6RrN'><center id='M6RrN'></center></pre></bdo></b><th id='M6RrN'></th></span></q></dt></tr></i><div id='M6RrN'><tfoot id='M6RrN'></tfoot><dl id='M6RrN'><fieldset id='M6RrN'></fieldset></dl></div>

                            <bdo id='M6RrN'></bdo><ul id='M6RrN'></ul>