- use pip install "sqlacodegen".
- command $
sqlacodegen mysql://users:pass@localhost/db_name --outfile tables.py.
Finish.
2014年8月31日 星期日
Database maps to Sqlalchemy
2014年8月1日 星期五
uWSGI and Nginx
- uwsgi --socket /tmp/uwsgi.sock -w Flask:app --chmod-socket=666
- /etc/nginx/site-enable/
- # mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream flask {
server unix:///tmp/uwsgi.sock;
}
# configuration of the server
server {
# the port your site will be served on
listen 7777;
# the domain name it will serve for
server_name PinLiang.example.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/pinliang/Restful/Money/media; # your Django project's media files - amend as required
}
location /static {
alias /home/pinliang/Restful/Money/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass flask;
include /home/pinliang/Restful/Money/uwsgi_params; # the uwsgi_params file you installed
}
} - [uwsgi]
chdir = /home/pinliang
module = Flask
callable = app
master = true
processes = 1
socket = /tmp/uwsgi.sock
chmod-socket = 666
vacuum = true
訂閱:
文章 (Atom)