Tag: python 3.x

在远程主机上的Docker flask uwsgi 404

更新2 我configuration我的路由在从create_app调用的configure_blueprints。 我不想把所有的视图处理程序放在uwsgi.py中。 它们存储在单独的模块中。 def configure_blueprints(app): from .root import root_bp … blueprints = [ (root_bp, None), … ] for bp, endpoint in blueprints: app.register_blueprint(bp, url_prefix=endpoint) return app def create_app(config_fn=None): app = Flask(__name__, template_folder='../templates', static_folder='../static') … configure_blueprints(app) return app 应用程序/根/ views.py root_bp = Blueprint('root_bp', __name__) @root_bp.route('/') def root(): if not current_user.is_authenticated: return redirect('/login/') return render_template('index.html') 这里是SIMPLE_SETTINGS=app.config,instance.docker […]

使用dockerimage读取和写入文件

我有一个简单的python脚本,它从磁盘中读取一个.csv文件,对其进行处理,将其放入一个数据框,并将其写入另一个.csv文件中。 现在,我已经从这个脚本中创build了一个docker镜像,并且想运行镜像来处理这个文件。但是我没有得到任何输出。 用于构build映像的Dockerfile的详细信息如下所示: FROM python:3 ADD io_python.py RUN pip install pandas CMD [ "python", "./io_python.py" ] io_python.py是读取,处理和输出csv文件的python脚本。我是从Windows机器运行的。 任何帮助将不胜感激,谢谢!

在Docker容器中构buildsphinx文档

我有一个在Docker容器中运行的Flask项目。 我设法build立我的应用程序并成功运行它。 不过,我也想build立狮身人面像文件,所以它的静态文件可以送达。 文档通常使用docs/文件中的make html构build。 我已经find了sphinx的docker源代码,并且已经build立了一个成功运行的docker-composeconfiguration,但是我不能将make html命令传递给sphinx – 我相信因为我正在运行命令,因为make html需要在docs/内运行,而不是从基本目录内运行。 我尝试构buildsphinx文档时出现以下错误: docker-compose run –rm sphinx make html Starting web_project Pulling sphinx (nickjer/docker-sphinx:latest)… latest: Pulling from nickjer/docker-sphinx c62795f78da9: Pull complete d4fceeeb758e: Pull complete 5c9125a401ae: Pull complete 0062f774e994: Pull complete 6b33fd031fac: Pull complete aac5b231ab1e: Pull complete 97be0ae484bc: Pull complete ec7c8cca5e46: Pull complete 82cc981959eb: Pull complete 151a33a826a1: Pull […]

Docker-用Python3编写目录错误

我目前正在尝试运行: FrankieMacBook-Pro-2candidacy-job-slurper$ Docker-compose up 并面临这个错误: Starting candidacyjobslurper_app_1 ERROR: for app Cannot start service app: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\\"/Users/Frankie/Documents/schmave/candidacy-job-slurper\\\" to rootfs \\\"/var/lib/docker/overlay2/9f39fb2e93c5d089eb163e495c1079465264a691acf36e7b53897058f3f7c7ec/merged\\\" at \\\"/var/lib/docker/overlay2/9f39fb2e93c5d089eb163e495c1079465264a691acf36e7b53897058f3f7c7ec/merged/code\\\" caused \\\"not a directory\\\"\"" : Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified […]

在Python中使用Docker进行图像训练(新手)

到目前为止,我所有的步骤都工作得很好。 我目前在一台Windows机器上。 我在使用该命令后在根目录中: docker run -it gcr.io /tensorflow/tensorflow:latest-devel 然后是cd / tensorflow,我现在在目录中,是时候训练的图像,所以我jused: / tensorflow#python tensorflow / examples / image_retraining / retrain.py \ –bottleneck_dir = / tf_files / bottlenets \ –how_many_training_steps 500 \ –model_dir = / tf_files / retrained_graph.pb \ –output_labels = / tf_files / retrained_labels.txt \ –image_dir / tf_files / 我得到这个错误:文件“tensorflow / examples / image_retraining / […]

无限地在后台运行Python脚本

我正在尝试编写一个在另一个服务器上运行的python脚本,即使我在我的PCterminal上closures了我的服务器连接,它也会继续在该服务器上运行。当脚本保持活动状态时,它会无限次地运行网站(UI),事件发生后,它会适当地启动某些泊坞窗并继续收听PosgreSQL事件。 当我尝试使用nohup (在后台运行脚本)时,它在后台运行,但无法收听任何事件。 有没有人从事过类似的事情? 请分享你的想法。 我正在分享我的脚本的一部分。 self.pool = await asyncpg.create_pool(user='alg_user',password='algy',database='alg',host='brain',port=6543) async with self.pool.acquire() as conn: def enqueue_listener(*args): self.queue.put_nowait(args) await conn.add_listener('task_created', enqueue_listener) print("Added the listener") while True: print("—- Listening for new job —-") conn2, pid, channel, payload = await self.queue.get() x = re.sub("[^\w]", " ", payload).split() print(x) if x[5] == '1': tsk = 'TASK_ID=%s' % str(x[1]) […]

AttributeError:模块'wagtail.wagtailadmin.edit_handlers'没有属性'FieldPanel'

python3.6 w 1. 1.10.1几个小时前,我的基于w based的项目停止发射成功。 它在这里失败: from wagtail.wagtailadmin import edit_handlers print(dir(edit_handlers)) class Article(Page): html = RichTextField() content_panels = Page.content_panels + [ edit_handlers.FieldPanel('html', classname="full"), edit_handlers.InlinePanel('gallery', label="Carousel items", classname='ArticleImage'), ] 与错误 AttributeError: module 'wagtail.wagtailadmin.edit_handlers' has no attribute 'FieldPanel' 之后,我决定确保它不是我的环境和configuration的docker文件的错误: FROM python:latest ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install -r requirements.txt […]

使用Django和Docker从MySQL迁移到postgresql – 关系“authtoken_token”不存在

我正在尝试使用MySQL数据库将我的Django项目迁移到使用Docker的postgresql。 当我使用MySQL时,一切正常。 我有所有在ORM,所以当我使用MySQL时,我必须创build唯一的数据库和做的python manage.py makemigrations ,然后python manage.py migrate ,我准备好所有关系的数据库。 正如我所提到的,我试图使用postgresql数据库。 服务器似乎工作正常使用docker-compose up ,但是当我发送实例GET请求我得到: ProgrammingError at /data relation "authtoken_token" does not exist LINE 1: …user"."is_active", "auth_user"."date_joined" FROM "authtoken… 我的设置: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'postgres', 'USER': 'postgres', 'HOST': 'db', 'PORT': 5432, } } 我docker-compose.yml : version: '3' services: db: image: postgres web: build: […]

部署在Heroku dockerized Web应用程序 – 错误代码= H14 desc =“没有web进程运行”

我想部署在Heroku我的项目在Docker与Angular 4前端,Django的后端和postgresql数据库。 在这个时候我的文件看起来如下所示。 在活动中,我有信息, Build succeeded但是在日志中我得到错误at=error code=H14 desc="No web processes running" method=GET path="/" host=myapp request_id=fe4c4613-7c39-49c2-a354-ee1f195de922 fwd="109.173.154.199" dyno= connect= service= status=503 bytes= protocol=https 我发现我应该尝试heroku ps:scale worker=1但我得到的信息Couldn't find that process type. 任何build议或其他想法如何平滑error code=H14 ? 项目树: ├── Backend │ ├── AI │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── […]

zap代理扫描器和excregexes选项不通过-config标志设置?

我试图设置configuration,当我开始zap.sh 这里描述。 docker run -p 8090:8090 -i owasp/zap2docker-stable zap.sh -daemon -port 8090 -host 0.0.0.0 -config api.key=0123456789 -config api.addrs.addr.name=.* -config api.addrs.addr.regex=true -config scanner.strength=INSANE -config scanner.threshold=HIGH -config context.excregexes='^(?:(?!https?:\/\/example\.com).*).$' 但是当我开始扫描时指出google.com。 它显示在日志中 16818 [Thread-10] INFO org.parosproxy.paros.core.scanner.HostProcess – start host https://google.com | TestPathTraversal strength MEDIUM threshold MEDIUM 这意味着扫描程序的强度和阈值的变化被忽略,我排除任何不在example.com上的正则expression式。 我究竟做错了什么? 注意:使用owasp / zap2docker-stable,尝试使用稍微修改过的版本运行。