spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

How I can run /myapp/my_app.py by default when accessing `localhost` using Bottle?


I finally have "Hello World!" displaying in the browser at localhost.

I will paste the various required configs and files below.

I'm a newb so I don't know if this is definitive or best practise.

/var/www/html/myapp/app.wsgi

# view the effect of import method:  
http://stackoverflow.com/a/2452639/1063287

import bottle 
import os

os.chdir(os.path.dirname(__file__))

# note i am using bottle.route and not just route
@bottle.route('/') 
def hello():
    return "Hello World!"

application = bottle.default_app()

/etc/apache2/sites-available/000-default.conf (note: this is the default .conf file)

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    WSGIScriptAlias / /var/www/html/myapp/app.wsgi
# just added this
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log
combined
</VirtualHost>

Viewing the Apache error log is what eventually led me to try a few different things:

sudo tail -100
/var/log/apache2/error.log

Where I saw things like:

Exception occurred processing WSGI
script '/var/www/html/myapp/app.wsgi'.
Traceback (most recent call last):
File "/var/www/html/myapp/app.wsgi", line 8, in
<module>
@route('/')
NameError: name 'route' is not defined

This was only after I had made the step of not using a new .conf file and just modifying the default one.

So for some reason it didn't like any new .conf files.


Categories : Python

Related to : How I can run /myapp/my_app.py by default when accessing `localhost` using Bottle?
Default localhost can't be accessed after installing virtual hosts on WAMP
Ok first get rid of these 2 section of httpd-vhosts.conf, these 2 bits are just what Apache release as sample code to get you started and are irrelevant to WAMPServer as they point to locations that are not used by WAMPServer. So delete these 2 definitions <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "c:/Apache24/docs/dummy-host.example.com" Serv

Categories : Wordpress
rails newbie: upon resource creation, render :location returns localhost:3000/users.id instead of localhost:3000/users/id
Here is the solution: def create user = User.create(name: params[:user]) render :json => JSON.pretty_generate(user.as_json), :status => 200, content_type: 'application/json', location: url_for(user) # you did mistake here. end I hope this will help!

Categories : Ruby On Rails
How to replicate a Python 2.7, Bottle, MongoDB OpenShift application locally in Linux Mint 17?
Directory Structure This is the structure of my app now that it is running locally: Environment Linux Mint 17 Cinnamon Steps To Replicate Locally 01) MongoDB 2.4.9 - DONE Install instructions for MongoDB 2.4.9 on Linux Mint 17: http://docs.mongodb.org/v2.4/tutorial/install-mongodb-on-ubuntu 02) RockMongo 1.1 (which requires Apache, PHP and MongoDB Driver) - DONE sudo apt-get install a

Categories : Mongodb
Deezer Javascript SDK on localhost
You can try with : channelUrl: 'http://yourAppDomain.com/channel.php' or channelUrl: 'http://yourAppDomain.com/channel.html

Categories : Javascript
Lamp on ubuntu 14.04 .Only want localhost - how?
Well you don't have to worry too much about this, but there is a solution to be sure that is only localhost. You need to configure your Apache to listen only to your localhost address and port. The solution is a bit old, but I don't have Lamp installed on my computer so you have to try it and tell me if it works. This can be done by editing the file: /etc/apache2/ports.conf You can do that w

Categories : Linux
Recently Add
Overriding save method vs Model Method?
function encrypt file - input & output to same file in python
urllib.error.URLError:
python if statement fails to compute compound logic
referencing sphinx generated Python docs from YAML file
Subclassing datetime64
filter view from url parameter with an intermediate model?
How to stream twitter mentions with tweepy?
How to space out rows and columns in Python Tkinter
Python: Using BeautifulSoup to save content to CSV
Python - Take parts of a txt file and put them in another txt
Python socket send doesn't send the whole string
Python: prime test
How to import one day old logs
Appending filters to django models
Python: parsing .xls file failed with both xlrd and pandas
writing pandas dataframe columns to csv rows staggered
parse_args doesn't seem to understand json arguments
Django ORM, get data
Pygame, keep jumping and glitching through the "ground"
Is it possible to import a class defined inside a function?
How to handle a variable number of nested for loops?
Boolean expression with strings
Object duplicated when using processing.Manager?
What is the syntax of PBS job limit directive
python 3.x overwrite previous terminal line
Deploying django app. on heroku (gunicorn, wsgi issue)
How can I create an "ID" column in one dataframe based on the index of another dataframe?
PIL Module Error
pandas.read_html returns only one table
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.