How to build a Web App in 60 minutes

| Tags Programming 

From 0 to 1: How to build an Web App in 60 minutes.

  • Cloud Hosting: Linode - High performance SSD Linux servers.
  • Web Server: nginx - HTTP and reverse proxy server.
  • Web Framework: Tornado - Python web framework and asynchronous networking library.
  • Supervisor - A Process Control System.

1. Write a Web app with Tornaodo

Tornado is a Python web framework. You can easily write a web app with a few lines of code.

The one is a demo that shows how to crawl the feed of Hacker NewsMediumProduct Hunt and serve as an API. You can check this project in detail here.

Structure

the_one/
    handlers/
        feed.py
    lib/
    logconfig/
    media/
        css/
            vendor/
        js/
            vendor/
        images/
    templates/
    vendor/
    environment.py
    fabfile.py
    app.py
    settings.py

2. Getting Started with Linode

Congratulations on selecting Linode as your cloud hosting provider, follow this guide will help you sign up for an account, deploy a Linux distribution, boot your Linode, and perform some basic system administration tasks. I use this Linux distribution: CentOS 7.0.

Linode

3. nginx

Install

1. Add Nginx Repository: sudo yum install epel-release

2. Install Nginx: sudo yum install nginx

3. Start Nginx: sudo systemctl start nginx

4. Enable Nginx to start when your system boots: sudo systemctl enable nginx

You can do a spot check right away to verify everything works well by visiting your server’s public IP address in your browser.

http://server_domain_name_or_IP/

You will see the default CentOS 7.0 nginx web page, it should look like this:

nginx

Congratulations! nginx is now installed and running!

Configuration

The main Nginx configuration file is located at /etc/nginx/nginx.conf. This is where you can change settings like the user that runs the Nginx daemon processes, and the number of worker processes that get spawned when Nginx is running, among other things.

4. Configurate with Supervisor

1. Install: sudo pip install supervisor
2. Setup: echo_supervisord_conf > supervisord.conf

Back     Next
comments powered by Disqus