遵循docker-compose教程时未创建django应用 [英] no django app created when following the docker-compose tutorial

查看:60
本文介绍了遵循docker-compose教程时未创建django应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循docker-compose教程,以尝试弄清楚如何部署django应用程序:

I'm following the docker-compose tutorial, to try and figure out how to get a django app to deploy: http://docs.docker.com/compose/django/

一切都进行得很顺利(该应用程序甚至可以正常工作!),但是django项目文件夹 composeexample 并未在我的本地项目目录中创建.

And everything's going smoothly (the app even works!) but the django project folder composeexample isn't created in my local project directory.

我剩下的作品是"It Works!".运行后的页面:

I'm left with a working "It Works!" page after running:

$ docker-compose run web django-admin.py startproject composeexample.

但是,我不能继续编辑 composeexample/settings.py ,如本教程所建议:该文件夹在我的机器上不存在(它确实存在于容器中,但是没有)在那里对我很好!)

But I can't continue to edit the composeexample/settings.py, as the tutorial suggests: The folder doesn't exist on my machine (it does exist in the container, but it's no good to me there!)

教程有误吗?我听不正确吗?

谢谢!

更新:

这是问题所在,我正在使用docker-machine通过远程docker实例运行整个过程.使用远程docker计算机时,有关本地文件夹共享的规则是否有所不同?

Here's the problem, I'm using docker-machine to run this whole process through a remote docker instance. Are the rules about local folder sharing different when using a remote docker machine?

推荐答案

您需要设置一个dockerfile,以便在执行docker build时,它将本地代码复制到容器中.首先,您需要将文件从容器复制到本地.在这里寻找.或者只是用您自己的django应用程序覆盖目录

You need to set up a dockerfile so that when you do a docker build, it copies your local code onto the container. To get started, you will need to copy the files from container to local. Look here for that. Or just overwrite the directory with your own django app

将文件从主机复制到Docker容器

示例:

FROM python:2.7
RUN mkdir /code
WORKDIR /code
ADD . /code/

这篇关于遵循docker-compose教程时未创建django应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆