Nginx+bottle+uwsgi Server returning 404 on every request

2024/10/15 19:22:06

I have setup an Nginx server with following configuration:

server {listen 8080;server_name localhost;location / {include uwsgi_params;uwsgi_pass unix:/tmp/uwsgi.notesapi.socket;uwsgi_param UWSGI_PYHOME /home/ubuntu/notesAPI/env;uwsgi_param UWSGI_CHIDIR /home/ubuntu/notesAPI/src;uwsgi_param UWSGI_SCRIPT Notes;}}

I have setup a bottle app with initial following initial script:

import sys from settings.constants import PROJECT_ROOT print PROJECT_ROOT sys.path.insert(0, PROJECT_ROOT)import bottle from bottle import Bottle, debug from settings import routesNotes = Bottle() routes.set(Notes)debug(True)
if __name__ == '__main__':Notes.run(host='0.0.0.0', port=8080, reloader=True)
else:application = bottle.default_app()

When I send a GET request to the server I get a 404 even though the routes are perfectly set.

Here is the uwsgi.log:

[uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini

[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/uwsgi.ini

Fri Jun 21 04:47:26 2013 - * Starting uWSGI 1.0.3-debian (64bit) on [Fri Jun 21 04:47:26 2013] *

Fri Jun 21 04:47:26 2013 - compiled with version: 4.6.3 on 17 July 2012 02:26:54

Fri Jun 21 04:47:26 2013 - current working directory: /

Fri Jun 21 04:47:26 2013 - writing pidfile to /run/uwsgi/app/uwsgi/pid

Fri Jun 21 04:47:26 2013 - detected binary path: /usr/bin/uwsgi-core

Fri Jun 21 04:47:26 2013 - setgid() to 33

Fri Jun 21 04:47:26 2013 - setuid() to 33

Fri Jun 21 04:47:26 2013 - your memory page size is 4096 bytes

Fri Jun 21 04:47:26 2013 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/uwsgi/socket fd 5

Fri Jun 21 04:47:26 2013 - uwsgi socket 1 bound to UNIX address /tmp/uwsgi.notesapi.socket fd 6

Fri Jun 21 04:47:26 2013 - Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]

Fri Jun 21 04:47:26 2013 - Set PythonHome to /home/ubuntu/notesAPI/env

Fri Jun 21 04:47:26 2013 - Python main interpreter initialized at 0x1f27e60

Fri Jun 21 04:47:26 2013 - your server socket listen backlog is limited to 100 connections Fri Jun 21 04:47:26 2013 - * Operational MODE: preforking *

Fri Jun 21 04:47:26 2013 - added /home/ubuntu/notesAPI/src/ to pythonpath.

Fri Jun 21 04:47:26 2013 - * no app loaded. going in full dynamic mode *

Fri Jun 21 04:47:26 2013 - * uWSGI is running in multiple interpreter mode *

Fri Jun 21 04:47:26 2013 - spawned uWSGI master process (pid: 25575)

Fri Jun 21 04:47:26 2013 - spawned uWSGI worker 1 (pid: 25583, cores: 1)

Fri Jun 21 04:47:26 2013 - spawned uWSGI worker 2 (pid: 25584, cores: 1)

/home/ubuntu/notesAPI/src

Fri Jun 21 04:55:28 2013 - WSGI application 0 (mountpoint='') ready on interpreter 0x1f27e60 pid: 25583 (default app) [pid: 25583|app: 0|req: 1/1] 117.196.135.124 () {44 vars in 686 bytes} [Fri Jun 21 04:55:28 2013] GET / => generated 723 bytes in 188 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)

I am pretty new to uwsgi and nginx. I can't seem to figure out the problem.

Answer

Are you sure that NGINX and UWSGI are working properly? Lot's of things could be wrong, I recommend you to follow this guide: https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

It's a step by step to setup NGINX and UWSGI with Django but I'm pretty sure you can apply it to any other web app than Django.

https://en.xdnf.cn/q/117797.html

Related Q&A

Checking multiple for items in a for loop python

Ive written a code to tell the user that the their brackets are not balanced.I can exactly tell where my code is going wrong.Once it comes across the first situation of brackets, it does not continue t…

Can I export pandas DataFrame to Excel stripping tzinfo?

I have a timezone aware TimeSeries in pandas 0.10.1. I want to export to Excel, but the timezone prevents the date from being recognized as a date in Excel.In [40]: resultado Out[40]: fecha_hora 2013-…

Converting kwargs into variables?

How do I convert kwargs objects into local variables? I am a math teacher and I want to write a helper function where I can use JS-style template strings to write problems.I want to do something like …

Maya Python: Unbound Method due to Reload()

I have two files that import the same object tracking method from a third file. It works something like thisfile TrackingMethodclass Tracker(object):def __init__(self,nodeName=None,dag=None,obj=None):#…

How to append to a table in BigQuery using Python BigQuery API

Ive been able to append/create a table from a Pandas dataframe using the pandas-gbq package. In particular using the to_gbq method. However, When I want to check the table using the BigQuery web UI I s…

Splitting values out of a CSV Reader Python

Here is my current code a_reader = None a_reader = open(data.csv, rU) a_csv_reader = csv.reader(a_reader)for row in a_csv_reader:print row a_reader.close()count = 0 sum = 0.0 a_reader = open(…

python - list variable not storing proper result in recursion

I am trying to store all possible parenthesisation of a list through recursion.Example: printRange(0,3) Answer will be [[0],[1], [2]], [[0], [1, 2]], [[0, 1], [2]], [[0, 1, 2]]I could get a right answe…

Embedding matplotlib canvas into tkinter GUI - plot is not showing up, but no error is thrown

Running the python python script below does not show the embedded matplotlib plot. However it also throws no error message. Upon running the script, it is supposed to display a GUI displaying 4 buttons…

Can I get rid of this b character in my print statement? [duplicate]

This question already has answers here:What does a b prefix before a python string mean?(2 answers)Closed 7 years ago.Im wondering what this b charcter is and why its appearing. Im also wondering if I…

Python tkinter: configure multiple labels with a loop

I have a window with multiple labels. Instead of configuring each label individually, I want to use a for loop to configure them.Basically, what I get from the below code is all labels are showing the …