28 Jan 2014 from sqlalchemy import create_engine , Table , MetaData
engine = create_engine ( ' mysql+mysqldb://username:password@111.111.111.111/databaseName ' )
metadata = MetaData ( bind = engine )
metadata . reflect ( engine )
print metadata . tables . keys ()
You could also use that for looping through a list of the tables in the database.
28 Jan 2014 # show api routes
for route in app . url_map . iter_rules ():
print route . rule
27 Jan 2014 In case you haven’t already noticed, the command in the title won’t work.
You need to use: pip install MySQL-python
This article explains the correct approach: http://mysql-python.blogspot.com/2012/11/is-mysqldb-hard-to-install.html
21 Jan 2014 http://stackoverflow.com/questions/6290162/how-to-automatically-reflect-database-to-sqlalchemy-declarative
That is the key to the kingdom when it comes to using extensions like Flask-Admin and Flask-Restless on existing tables which do not have a class already.
18 Jan 2014 Install VNC server on Ubuntu Server 12.04 (Amahi Wiki)
That guide gave me the least amount of hassle when I installed VNC on a server. I started by trying to get it working with 13.10, but had issues with a grey screen when tightvnc connected.
15 Jan 2014 I got rid of this error just by creating the database manually. Shouldn’t Cake do this?
15 Jan 2014 Rather than dealing with my .htaccess problems to fix the error, I thought this would be a better approach: http://wwdj.wijndaele.com/getting-started-with-cakephp-without-mod_rewrite/
Unfortunately, it messed up quite a few links on my site.
I ended up solving the problem by changing “AllowOverride” None to “AllowOverride All” in my /etc/apache2/sites-available/default file.
Why the heck is CakePHP using .htaccess files by default anyway? Yii has this more streamlined.
15 Jan 2014 While I was searching for a some good boilerplate to start my first CakePHP project with, I found this: https://github.com/hugodias/cakeStrap
There’s also this one, but it has much fewer commits: https://github.com/zynesis/cakephp-boilerplate
07 Jan 2014 Got this error when I was missing a library that came with the build.
If you’re getting this error, you may need to move the lib folder from your build directory into the folder of your JAR file.
03 Jan 2014 You can access the endpoint parameter by using self.endpoint.
class displayResults ( BaseView ):
@expose ( ' / ' , methods = ( ' GET ' , ' POST ' ))
def index ( self ):
print self . endpoint
admin . add_view ( displayResults ( name = ' test ' , endpoint = ' test2 ' ))
That will print “test2”.