如何使用Heroku / Virtualenv / Django创建/使您的应用程序本地化? [英] How to create/make your app LOCAL with Heroku/Virtualenv/Django?

查看:79
本文介绍了如何使用Heroku / Virtualenv / Django创建/使您的应用程序本地化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我迄今为止所做的:

Here's what i've done so far:


  • 安装了Git Bash和Heroku,以及工头。

  • 登录,创建了一个密钥等...

  • 从Git克隆了一个演示应用程序。

  • 在浏览器上部署/测试。有用。

  • Installed Git Bash and Heroku, and Foreman.
  • Logged in, created a key, etc...
  • Cloned a demo app from Git.
  • Deployed/Tested it on the browser. It works.

我正在这个目录中工作:

I'm working on this directory:

*/python-getting-started (master)*


Which has this stuff:
Procfile
gettingstarted
manage.py
runtime.txt
README.md
**hello ( My app)**
requirements.txt

嗯,文件被命名( init ,manage.py,这样的东西...)我假设Django是托管在远程机器上(Heroku Machine?)...而当在本地运行应用程序时,我不知道如何使用virtualenv来做到这一点.....

Well, by the files are named (init, manage.py, stuff like that...) i assume Django is hosted on the remote machine (Heroku Machine?)... And when it comes to running the app locally, i'm not sure how to use virtualenv to do that.....

我应该在远程文件夹内设置virtualenv吗?如果是正确的,那是什么意思?我可以使用python本身,而不需要virtualenv ...

Should i "set" virtualenv inside the remote folder? If that's correct, what's the point? I could just use python itself without need for virtualenv...

我不知道我的问题是否有意义,如果你需要知道任何其他的东西,请...
现在试图设置这两天...

I'm not sure if my question is making any sense, if you need to know any other thing please... Been trying to set up this for two days now...

推荐答案

A git push heroku_remote_name local_branch_name:master call将该分支代码推送到Heroku。 Heroku然后执行以下操作...

A git push heroku_remote_name local_branch_name:master call will push that branch of code to Heroku. Heroku then does the following...


  • 拉入代码更改

  • 安装 pip 要求列在 requirements.txt

  • 通过调用dyno code> python manage.py runserver 在远程Web服务器上。

  • Pulls in code changes
  • Installs pip requirements listed in requirements.txt
  • Relaunches the "dyno" web server by invoking python manage.py runserver on the remote web server.

如果要在本地运行Web应用程序,您将需要创建一个virtualenv并在本地调用 python manage.py runserver

If you want to run the web application locally, you will want to create a virtualenv and invoke python manage.py runserver locally.

如果你在linux上,这里有一堆应该让你聪明工作的命令。如果你不在linux上,这些步骤至少应该说明你想做什么。

If you are on linux, here are a bunch of commands that should have you working smartly. If you're not on linux, the steps should at least be illustrative of what you will want to do.


  • sudo apt-get install -y python-pip

  • sudo pip install virtualenvwrapper

  • sudo pip install autoenv

  • cd path / to / project

  • mkvirtualenv venv_name_here

  • echosource /home/your_username/.virtualenvs/venv_name_here/bin/activate>> .env

  • cd。

  • python manage.py syncdb

  • python manage.py runserver 0.0.0.0:8000

  • sudo apt-get install -y python-pip
  • sudo pip install virtualenvwrapper
  • sudo pip install autoenv
  • cd path/to/project
  • mkvirtualenv venv_name_here
  • echo "source /home/your_username/.virtualenvs/venv_name_here/bin/activate" >> .env
  • cd .
  • python manage.py syncdb
  • python manage.py runserver 0.0.0.0:8000

这篇关于如何使用Heroku / Virtualenv / Django创建/使您的应用程序本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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