---
# System prepended metadata

title: uWSGI installation

---

# uWSGI installation
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
https://uwsgi-docs.readthedocs.io/en/latest/Install.html

uWSGI is a (big) C application, so you need a C compiler (like gcc or clang) and the Python development headers.
## You can install uWSGI via **pip** or **shell**
###### **sudo** may be required 

### pip install uwsgi
for centos
```shell=
sudo yum install python3-devel
```
If you encounter below error message:
> Exception: you need a C compiler to build uWSGI

Install required development tools with below commands
```shell=
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel python-devel
```


for Ubuntu (Debian-based distro)
```shell=
sudo apt-get install python3-dev
```
then below might work
```shell=
sudo pip3 install uwsgi
```
### Shell install uwsgi
```shell=
sudo yum install uwsgi
```


## prepare test.py
```python=
# test.py
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return [b"Hello World"] # python3
    #return ["Hello World"] # python2
```

## run test
```shell=
uwsgi --http :8000 --wsgi-file test.py
```
If you encounter below error message:

> uwsgi: option '--http' is ambiguous; possibilities: '--http-socket' '--https-socket-modifier2' 
> '--https-socket-modifier1' '--https-socket' '--http11-socket' '--http-socket-modifier2' 
> '--http-socket-modifier1'
> getopt_long() error

install plugins and run
```shell=
yum install uwsgi-plugin-common
# or
yum install uwsgi-plugin-python
```

## Browser

Note that it's **NOT https**
>http://<external ip>:8000






