Commits

Andriy Kornatskyy  committed 3c0f0fb

Added Makefile to guestbook demo.

  • Participants
  • Parent commits 3df239c

Comments (0)

Files changed (2)

File demos/guestbook/Makefile

+.SILENT: clean env pypy uwsgi gunicorn
+.PHONY: clean env pypy uwsgi gunicorn
+
+VERSION=2.7
+PYPI=http://pypi.python.org/simple
+ENV=env
+
+PYTHON=$(ENV)/bin/python$(VERSION)
+PYPY=pypy-1.9
+
+SERVER=uwsgi
+
+
+env:
+	PYTHON_EXE=/usr/local/bin/python$(VERSION); \
+	if [ ! -x $$PYTHON_EXE ]; then \
+		    PYTHON_EXE=/usr/bin/python$(VERSION); \
+	fi; \
+	virtualenv --python=$$PYTHON_EXE --no-site-packages env
+
+	$(ENV)/bin/easy_install-$(VERSION) -i $(PYPI) -O2 \
+		uwsgi mako wheezy.web
+
+pypy:
+	if [ ! -f $(PYPY)-linux.tar.bz2 ]; then \
+		wget https://bitbucket.org/pypy/pypy/downloads/$(PYPY)-linux.tar.bz2; \
+	fi; \
+	tar xjf $(PYPY)-linux.tar.bz2; \
+	wget http://python-distribute.org/distribute_setup.py; \
+	$(PYPY)/bin/pypy distribute_setup.py ; \
+	$(PYPY)/bin/easy_install -i $(PYPI) -O2 \
+		gunicorn mako wheezy.web
+
+clean:
+	find ./ -type d -name __pycache__ | xargs rm -rf
+	find ./ -name '*.py[co]' -delete
+
+uwsgi:
+	$(ENV)/bin/uwsgi --ini config.ini
+
+gunicorn:
+	export PYTHONPATH=$$PYTHONPATH:. ; \
+	$(ENV)/bin/gunicorn -b 0.0.0.0:8080 -w 4 app:main

File demos/guestbook/config.ini

+
+[uwsgi]
+chdir = .
+virtualenv = ../../env
+pythonpath = .
+wsgi = app:main
+procname-prefix = Guestbook-
+
+http-socket = 0.0.0.0:8080
+listen = 1024
+uid = www-data
+gid = www-data
+harakiri = 10
+optimize = 2
+master = True
+processes = 4
+disable-logging = True
+#logto = /dev/null
+no-default-app = False
+auto-procname = True
+limit-as = 70
+buffer-size = 2048
+post-buffering = 1024
+limit-post = 1024
+thread-stacksize = 64