SlideShare a Scribd company logo
SUSAN TAN
CISCO IN SAN FRANCISCO
TWITTER: @ARCTANSUSAN
HOW DO I RUN MULTIPLE PYTHON APPS
IN 1 COMMAND LINE UNDER 1 WSGI?
THIS IS A HELLO WORLD FLASK APP
from flask import Flask, request
app = Flask(__name__)
@app.route('/<name>')
def hello_world(name):
return "Hello %s, I'm a flask app!" % (name)
if __name__ == '__main__':
app.debug = True
app.run()
THIS IS A HELLO WORLD DJANGO APP
from django.http import HttpResponse
def hello(request, name):
return HttpResponse("<p>Hello, %s I'm a Django app.</p>" % (name,))
views.py
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^(?P<name>[-w]+)/$', 'hello_django.mysite.myapp.views.hello'),
)
urls.py
Django app runs at http://127.0.0.1:8000/
Flask app runs at http://127.0.0.1:5000/
An Observation
HOW DO I COMBINE BOTH PYTHON APPS?
SO THEY’RE BOTH ON SAME PORT? SAME COMMAND LINE ?
WSGI DISPATCHER
Source: Reference: http://flask.pocoo.org/docs/0.10/patterns/appdispatch/
CONFIGURE WSGI.PY IN DJANGO APP
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"hello_django.mysite.myapp.settings")
# This application object is used by any WSGI server
configured to use this
# file. This includes Django's development server, if
the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
wsgi.py
THIS IS A HELLO WORLD COMBINED FLASK & DJANGO APP
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
import hello_flask
from hello_django.mysite.myapp import wsgi as hello_django
application = DispatcherMiddleware(hello_flask.app, {
'/django': hello_django.application
})
if __name__ == '__main__':
run_simple('localhost', 4000, application,
use_reloader=True, use_debugger=True, use_evalex=True)
combined_apps.py
Let’s run more python web frameworks in 1
command line
LIVE DEMO TIME
Source Code?
https://github.com/ArcTanSusan/wsgi_lightnng_talk
Reference: http://flask.pocoo.org/docs/0.10/patterns/
appdispatch/
Slides? On slideshare. I tweeted them already.
Contact Info
Susan Tan
Twitter: @ArcTanSusan

More Related Content

What's hot

Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of ElixirYurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
Elixir Club
 
PHP Programming: Intro
PHP Programming: IntroPHP Programming: Intro
PHP Programming: Intro
Things Lab
 
23.simple login with sessions in laravel 5
23.simple login with sessions in laravel 523.simple login with sessions in laravel 5
23.simple login with sessions in laravel 5
Razvan Raducanu, PhD
 
Harrigan_Danielle_Programming
Harrigan_Danielle_ProgrammingHarrigan_Danielle_Programming
Harrigan_Danielle_ProgrammingDanielle Harrigan
 
Scratching the surface of hunky-dory Elixir features
Scratching the surface of hunky-dory Elixir featuresScratching the surface of hunky-dory Elixir features
Scratching the surface of hunky-dory Elixir features
Adam Hodowany
 
次世代PHPフレームワーク Symfony2
次世代PHPフレームワーク Symfony2次世代PHPフレームワーク Symfony2
次世代PHPフレームワーク Symfony2
Masao Maeda
 
UTAU DLL voicebank and ulauncher
UTAU DLL voicebank and ulauncherUTAU DLL voicebank and ulauncher
UTAU DLL voicebank and ulauncher
hunyosi
 
PHP and Databases
PHP and DatabasesPHP and Databases
PHP and Databases
Things Lab
 
You promise?
You promise?You promise?
You promise?
IT Weekend
 
[Erlang LT] Regexp Perl And Port
[Erlang LT] Regexp Perl And Port[Erlang LT] Regexp Perl And Port
[Erlang LT] Regexp Perl And Port
Keiichi Daiba
 
Winefontssmoothing en
Winefontssmoothing enWinefontssmoothing en
Winefontssmoothing enmunjikuo
 

What's hot (12)

Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of ElixirYurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
Yurii Bodarev - OTP, Phoenix & Ecto: Three Pillars of Elixir
 
Introduction to lua
Introduction to luaIntroduction to lua
Introduction to lua
 
PHP Programming: Intro
PHP Programming: IntroPHP Programming: Intro
PHP Programming: Intro
 
23.simple login with sessions in laravel 5
23.simple login with sessions in laravel 523.simple login with sessions in laravel 5
23.simple login with sessions in laravel 5
 
Harrigan_Danielle_Programming
Harrigan_Danielle_ProgrammingHarrigan_Danielle_Programming
Harrigan_Danielle_Programming
 
Scratching the surface of hunky-dory Elixir features
Scratching the surface of hunky-dory Elixir featuresScratching the surface of hunky-dory Elixir features
Scratching the surface of hunky-dory Elixir features
 
次世代PHPフレームワーク Symfony2
次世代PHPフレームワーク Symfony2次世代PHPフレームワーク Symfony2
次世代PHPフレームワーク Symfony2
 
UTAU DLL voicebank and ulauncher
UTAU DLL voicebank and ulauncherUTAU DLL voicebank and ulauncher
UTAU DLL voicebank and ulauncher
 
PHP and Databases
PHP and DatabasesPHP and Databases
PHP and Databases
 
You promise?
You promise?You promise?
You promise?
 
[Erlang LT] Regexp Perl And Port
[Erlang LT] Regexp Perl And Port[Erlang LT] Regexp Perl And Port
[Erlang LT] Regexp Perl And Port
 
Winefontssmoothing en
Winefontssmoothing enWinefontssmoothing en
Winefontssmoothing en
 

Viewers also liked

Garcia reyna luis angel
Garcia reyna luis angelGarcia reyna luis angel
Garcia reyna luis angel
myersreynaangel
 
Uso del internet
Uso del internetUso del internet
Uso del internet
monicopana
 
다이어트내비App 기획안
다이어트내비App 기획안다이어트내비App 기획안
다이어트내비App 기획안
jogihyeon
 
Algas azuis
Algas azuisAlgas azuis
Algas azuis
Jocimar Araujo
 
1rst ARCADIA project newsletter
1rst ARCADIA project newsletter1rst ARCADIA project newsletter
1rst ARCADIA project newsletter
EU ARCADIA PROJECT
 
Rfid tech for library | تحديد الهوية بموجات الراديو
Rfid tech for library | تحديد الهوية بموجات الراديوRfid tech for library | تحديد الهوية بموجات الراديو
Rfid tech for library | تحديد الهوية بموجات الراديو
Trans Gulf information technology
 
عرض الفصل 7 و8و9
عرض الفصل 7 و8و9عرض الفصل 7 و8و9
عرض الفصل 7 و8و9
Doody Mohammed
 
MoM2010: Steps to Patent Your Ideas
MoM2010: Steps to Patent Your IdeasMoM2010: Steps to Patent Your Ideas
MoM2010: Steps to Patent Your IdeasHend Al-Khalifa
 
Commibr4 الاتصال الفعال
Commibr4 الاتصال الفعالCommibr4 الاتصال الفعال
Commibr4 الاتصال الفعال
Ibrahim Suliman
 
Consumption Smoothing and Productive Investments in Rural Zambia
Consumption Smoothing and Productive Investments in Rural ZambiaConsumption Smoothing and Productive Investments in Rural Zambia
Consumption Smoothing and Productive Investments in Rural Zambia
TransferProjct
 
Protozoários sarcodina
Protozoários   sarcodinaProtozoários   sarcodina
Protozoários sarcodina
Jocimar Araujo
 
Driver based planning
Driver based planningDriver based planning
Driver based planningjarobertson2
 
محاضرتي الثانية
محاضرتي الثانيةمحاضرتي الثانية
محاضرتي الثانية
Amany Megahed
 
Patient safety culture
Patient safety culturePatient safety culture
ضبط الجودة النوعية فى المختبرات الطبية
ضبط الجودة النوعية فى المختبرات الطبيةضبط الجودة النوعية فى المختبرات الطبية
ضبط الجودة النوعية فى المختبرات الطبية
Manal Elsayed CPPS, CPHQ, CLSSBB, FISQua, DTQM
 
الجمعية الصحية الصومالية في الكويت
الجمعية الصحية الصومالية في الكويتالجمعية الصحية الصومالية في الكويت
الجمعية الصحية الصومالية في الكويت
Mohamed Abukar
 

Viewers also liked (16)

Garcia reyna luis angel
Garcia reyna luis angelGarcia reyna luis angel
Garcia reyna luis angel
 
Uso del internet
Uso del internetUso del internet
Uso del internet
 
다이어트내비App 기획안
다이어트내비App 기획안다이어트내비App 기획안
다이어트내비App 기획안
 
Algas azuis
Algas azuisAlgas azuis
Algas azuis
 
1rst ARCADIA project newsletter
1rst ARCADIA project newsletter1rst ARCADIA project newsletter
1rst ARCADIA project newsletter
 
Rfid tech for library | تحديد الهوية بموجات الراديو
Rfid tech for library | تحديد الهوية بموجات الراديوRfid tech for library | تحديد الهوية بموجات الراديو
Rfid tech for library | تحديد الهوية بموجات الراديو
 
عرض الفصل 7 و8و9
عرض الفصل 7 و8و9عرض الفصل 7 و8و9
عرض الفصل 7 و8و9
 
MoM2010: Steps to Patent Your Ideas
MoM2010: Steps to Patent Your IdeasMoM2010: Steps to Patent Your Ideas
MoM2010: Steps to Patent Your Ideas
 
Commibr4 الاتصال الفعال
Commibr4 الاتصال الفعالCommibr4 الاتصال الفعال
Commibr4 الاتصال الفعال
 
Consumption Smoothing and Productive Investments in Rural Zambia
Consumption Smoothing and Productive Investments in Rural ZambiaConsumption Smoothing and Productive Investments in Rural Zambia
Consumption Smoothing and Productive Investments in Rural Zambia
 
Protozoários sarcodina
Protozoários   sarcodinaProtozoários   sarcodina
Protozoários sarcodina
 
Driver based planning
Driver based planningDriver based planning
Driver based planning
 
محاضرتي الثانية
محاضرتي الثانيةمحاضرتي الثانية
محاضرتي الثانية
 
Patient safety culture
Patient safety culturePatient safety culture
Patient safety culture
 
ضبط الجودة النوعية فى المختبرات الطبية
ضبط الجودة النوعية فى المختبرات الطبيةضبط الجودة النوعية فى المختبرات الطبية
ضبط الجودة النوعية فى المختبرات الطبية
 
الجمعية الصحية الصومالية في الكويت
الجمعية الصحية الصومالية في الكويتالجمعية الصحية الصومالية في الكويت
الجمعية الصحية الصومالية في الكويت
 

Similar to How do I run multiple python apps in 1 command line under 1 WSGI app?

Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18
Lar21
 
Kyiv.py #17 Flask talk
Kyiv.py #17 Flask talkKyiv.py #17 Flask talk
Kyiv.py #17 Flask talk
Alexey Popravka
 
Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...
Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...
Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...
Akira Tsuruda
 
Flask & Flask-restx
Flask & Flask-restxFlask & Flask-restx
Flask & Flask-restx
ammaraslam18
 
Flask patterns
Flask patternsFlask patterns
Flask patternsit-people
 
Flask restfulservices
Flask restfulservicesFlask restfulservices
Flask restfulservices
Marcos Lin
 
Python para web - Utilizando micro-framework Flask - PUG-MA
Python para web - Utilizando micro-framework Flask - PUG-MAPython para web - Utilizando micro-framework Flask - PUG-MA
Python para web - Utilizando micro-framework Flask - PUG-MA
Herson Leite
 
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Edureka!
 
Micropage in microtime using microframework
Micropage in microtime using microframeworkMicropage in microtime using microframework
Micropage in microtime using microframework
Radek Benkel
 
Developing Flask Extensions
Developing Flask ExtensionsDeveloping Flask Extensions
Developing Flask Extensions
Rachel Sanders
 
Flask Basics
Flask BasicsFlask Basics
Flask Basics
Eueung Mulyana
 
Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12
Jakub Zalas
 
The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]
Nilhcem
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
Nathan Smith
 
LvivPy - Flask in details
LvivPy - Flask in detailsLvivPy - Flask in details
LvivPy - Flask in details
Max Klymyshyn
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]
Nilhcem
 
Quality Use Of Plugin
Quality Use Of PluginQuality Use Of Plugin
Quality Use Of Plugin
Yasuo Harada
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
Anatoly Sharifulin
 
Practical Celery
Practical CeleryPractical Celery
Practical Celery
Cameron Maske
 
ReactPHP
ReactPHPReactPHP
ReactPHP
Philip Norton
 

Similar to How do I run multiple python apps in 1 command line under 1 WSGI app? (20)

Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18Flask - Backend com Python - Semcomp 18
Flask - Backend com Python - Semcomp 18
 
Kyiv.py #17 Flask talk
Kyiv.py #17 Flask talkKyiv.py #17 Flask talk
Kyiv.py #17 Flask talk
 
Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...
Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...
Flask-RESTPlusで便利なREST API開発 | Productive RESTful API development with Flask-...
 
Flask & Flask-restx
Flask & Flask-restxFlask & Flask-restx
Flask & Flask-restx
 
Flask patterns
Flask patternsFlask patterns
Flask patterns
 
Flask restfulservices
Flask restfulservicesFlask restfulservices
Flask restfulservices
 
Python para web - Utilizando micro-framework Flask - PUG-MA
Python para web - Utilizando micro-framework Flask - PUG-MAPython para web - Utilizando micro-framework Flask - PUG-MA
Python para web - Utilizando micro-framework Flask - PUG-MA
 
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
 
Micropage in microtime using microframework
Micropage in microtime using microframeworkMicropage in microtime using microframework
Micropage in microtime using microframework
 
Developing Flask Extensions
Developing Flask ExtensionsDeveloping Flask Extensions
Developing Flask Extensions
 
Flask Basics
Flask BasicsFlask Basics
Flask Basics
 
Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12Symfony components in the wild, PHPNW12
Symfony components in the wild, PHPNW12
 
The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]
 
DrupalCon jQuery
DrupalCon jQueryDrupalCon jQuery
DrupalCon jQuery
 
LvivPy - Flask in details
LvivPy - Flask in detailsLvivPy - Flask in details
LvivPy - Flask in details
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]
 
Quality Use Of Plugin
Quality Use Of PluginQuality Use Of Plugin
Quality Use Of Plugin
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Practical Celery
Practical CeleryPractical Celery
Practical Celery
 
ReactPHP
ReactPHPReactPHP
ReactPHP
 

More from Susan Tan

Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Susan Tan
 
Let's read code: python-requests library
Let's read code: python-requests libraryLet's read code: python-requests library
Let's read code: python-requests library
Susan Tan
 
How to Upgrade to the Newest Shiniest Django Version
How to Upgrade to the Newest Shiniest Django VersionHow to Upgrade to the Newest Shiniest Django Version
How to Upgrade to the Newest Shiniest Django Version
Susan Tan
 
Let's read code: the python-requests library
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests library
Susan Tan
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
Susan Tan
 
Python In The Browser: Intro to Brython
Python In The Browser: Intro to BrythonPython In The Browser: Intro to Brython
Python In The Browser: Intro to Brython
Susan Tan
 
How to choose an open-source project
How to choose an open-source projectHow to choose an open-source project
How to choose an open-source project
Susan Tan
 

More from Susan Tan (7)

Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
 
Let's read code: python-requests library
Let's read code: python-requests libraryLet's read code: python-requests library
Let's read code: python-requests library
 
How to Upgrade to the Newest Shiniest Django Version
How to Upgrade to the Newest Shiniest Django VersionHow to Upgrade to the Newest Shiniest Django Version
How to Upgrade to the Newest Shiniest Django Version
 
Let's read code: the python-requests library
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests library
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
 
Python In The Browser: Intro to Brython
Python In The Browser: Intro to BrythonPython In The Browser: Intro to Brython
Python In The Browser: Intro to Brython
 
How to choose an open-source project
How to choose an open-source projectHow to choose an open-source project
How to choose an open-source project
 

Recently uploaded

一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
harveenkaur52
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
2.Cellular Networks_The final stage of connectivity is achieved by segmenting...
2.Cellular Networks_The final stage of connectivity is achieved by segmenting...2.Cellular Networks_The final stage of connectivity is achieved by segmenting...
2.Cellular Networks_The final stage of connectivity is achieved by segmenting...
JeyaPerumal1
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
zoowe
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 

Recently uploaded (20)

一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
2.Cellular Networks_The final stage of connectivity is achieved by segmenting...
2.Cellular Networks_The final stage of connectivity is achieved by segmenting...2.Cellular Networks_The final stage of connectivity is achieved by segmenting...
2.Cellular Networks_The final stage of connectivity is achieved by segmenting...
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 

How do I run multiple python apps in 1 command line under 1 WSGI app?

  • 1. SUSAN TAN CISCO IN SAN FRANCISCO TWITTER: @ARCTANSUSAN HOW DO I RUN MULTIPLE PYTHON APPS IN 1 COMMAND LINE UNDER 1 WSGI?
  • 2. THIS IS A HELLO WORLD FLASK APP from flask import Flask, request app = Flask(__name__) @app.route('/<name>') def hello_world(name): return "Hello %s, I'm a flask app!" % (name) if __name__ == '__main__': app.debug = True app.run()
  • 3. THIS IS A HELLO WORLD DJANGO APP from django.http import HttpResponse def hello(request, name): return HttpResponse("<p>Hello, %s I'm a Django app.</p>" % (name,)) views.py from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^(?P<name>[-w]+)/$', 'hello_django.mysite.myapp.views.hello'), ) urls.py
  • 4. Django app runs at http://127.0.0.1:8000/ Flask app runs at http://127.0.0.1:5000/ An Observation HOW DO I COMBINE BOTH PYTHON APPS? SO THEY’RE BOTH ON SAME PORT? SAME COMMAND LINE ?
  • 7. CONFIGURE WSGI.PY IN DJANGO APP import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello_django.mysite.myapp.settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() wsgi.py
  • 8. THIS IS A HELLO WORLD COMBINED FLASK & DJANGO APP from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware import hello_flask from hello_django.mysite.myapp import wsgi as hello_django application = DispatcherMiddleware(hello_flask.app, { '/django': hello_django.application }) if __name__ == '__main__': run_simple('localhost', 4000, application, use_reloader=True, use_debugger=True, use_evalex=True) combined_apps.py
  • 9.
  • 10. Let’s run more python web frameworks in 1 command line LIVE DEMO TIME