web2py is a powerful and easy to learn Python web framework, it is a full stack framework which means that you are going to find built in features for almost aeverything you need on web development.
web2py is safe, fast, smart and it simply lets you to get things done!
(of course this is a biased oppinion :P )
Python is great! everybody loves it. Now imagine the possibility to have your Python Environment on the cloud, on that environment Python from version 2.5 to 3.2, in the same environment you have a mysql shell and a bash shell where you can use git, hg, unzip, tar, wget and many other *unix features and additionally you have a very nice cron-like scheduler to program python/sh tasks.
The best feature ever is the ability to share the same Console with many people and the ability to save the console session even if you loggout or need to switch form computer to tablet.
Thats http://www.PythonAnywhere.com ! The best place to learn, test, develop with your team and of course, the best place to host your websites and services!
web2py app on PythonAnywhere
- On Dashboard create a new web2py application
- Choose an admin password and click next to wait while your web2py app is created
This Process can take a bit of time, PA will download and unzip a new web2py stable source
and also it will configure your wsgi.py pointing to your web2py root folder.
When it finished you will see this screen:
Now you have a running web2py application running on http://yourname.pythonanywhere.com
Your appp should look like this:
- Files tab - you can browse, edit, create, upload and connect to a DropBox account
- web tab - You can reload your apache server, see your logs or edit your wsgi.py file
- Schedule tab - Here you can schedule task to run hourly or daily, tasks are sh or python scripts
- Mysql tab - here you can create a database and change passowrd, also check credentials for connection
- Consoles - the most powerful feature you can start and share consoles
Now that your are familiar with PythonAnywhere we can create our app, I am going to show how to do that using two approaches
Using web2py web IDE for coding and management
- Go to your app https://yourname.pythonanywhere.com/admin - Note the https, it is necessary to access the web2py admin
Thats the web2py admin interface, put the password you set on app install step
- Create a new simple app named app1
- Web2py will let you admin your app, edit files, create database models using the web interface
- Click in edit next to db.py under models section
Look for this line of code
db = DAL('sqlite://storage.sqlite') now we are going to change it
as it is connecting to a sqlite database, we want to change it to our mysql database
You can go to MYSQL tab on PythonAnywhere dashboard and create a new Mysql Databse, and also set a new password for Mysql user, create a database calles app1 and it will be accessible using yourname$app1 Dont forget to set a new MYSQL PASSWORD
- Lets change our db connection
In your https://**yourname**.pythonanywhere.com/admin/default/edit/app1/models/db.py
You will change:
db = DAL('sqlite://storage.sqlite')
IN TO THIS:
db = DAL('mysql://youname:yourMYSQLPassowrd@mysql.server/yourname$app1')
Click in the save icon or hit ctrl+S and then return to admin clicking edit in the main menu
Now you will see the following button next to models section
Click in database administration or go to https://**yourname**.pythonanywhere.com/app1/appadmin/index
It is the web2py appadmin, it allows you to see the tables defined in your models and existing in your db
comments powered by Disqus Go Top