Skip to content

Instantly share code, notes, and snippets.

@csinchok
Created January 7, 2014 20:26
Show Gist options
  • Select an option

  • Save csinchok/8306293 to your computer and use it in GitHub Desktop.

Select an option

Save csinchok/8306293 to your computer and use it in GitHub Desktop.
Just a little thing to build a uwsgi binary with an app embedded.
[uwsgi]
main_plugin = python
inherit = base
bin_name = betty-cropper
embed_files = examples/bootstrap.py,env/lib/python2.7/site-packages/betty,env/lib/python2.7/site-packages/wand,env/lib/python2.7/site-packages/flask,env/lib/python2.7/site-packages/jinja2,env/lib/python2.7/site-packages/werkzeug,env/lib/python2.7/site-packages/sqlalchemy,env/lib/python2.7/site-packages/itsdangerous,env/lib/python2.7/site-packages/markupsafe,env/lib/python2.7/site-packages/slimit
embed_config = uwsgi.ini
BUILD_DIR := $(shell mktemp -d -t "betty-build")
UWSGI_VERSION = 1.9.21.1
UWSGI_DIR = $(BUILD_DIR)/uwsgi-$(UWSGI_VERSION)
VENV_DIR =$(BUILD_DIR)/uwsgi-$(UWSGI_VERSION)/env
all: embed
embed:
virtualenv $(BUILD_DIR)
cd $(BUILD_DIR) && wget -O uwsgi.zip https://github.com/unbit/uwsgi/archive/$(UWSGI_VERSION).zip
cd $(BUILD_DIR) && unzip uwsgi.zip
virtualenv $(VENV_DIR)
. $(VENV_DIR)/bin/activate; pip install https://github.com/theonion/betty-cropper/tarball/master
cp uwsgi.ini $(UWSGI_DIR)/uwsgi.ini
cp buildconfig.ini $(UWSGI_DIR)/buildconf/betty.ini
. $(VENV_DIR)/bin/activate && cd $(UWSGI_DIR) && python uwsgiconfig.py --build betty
[uwsgi]
import = sym://bootstrap_py
module = betty:app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment