uwsgi: invalid option -- 'n' getopt_long() error

Hi, Iam stuck. I am following a tutorial “Full stack full stack web application raspberry pi” I am doing well, for a noob. The pi is a zero w with rasbian lite stretch, installed nginx, postgresql, php7, python3, pip, flask, installed uwsgi, The tutorial states ```>cd /var/www/heating/

vim heating_nginx.conf```

the code is

server {
server_name localhost;
client_max_body_size 75M;
location /static {
root /var/www/heating/;
location / { try_files $uri @heating; }
location @heating {
include uwsgi_params;
uwsgi_pass unix:/var/www/heating/heating_uwsgi.sock;
You are configuring an app

and then create the link >ln -s /var/www/lab_app/lab_app_nginx.conf /etc/nginx/conf.d/

and then >vim /var/www/lab_app/lab_app_uwsgi.ini

#application’s base folder
base = /var/www/heating
#python module to import
app = hello
module = %(app)
home = %(base)/venv
pythonpath = %(base)
#socket file’s location
socket = /var/www/heating/%n.sock
#permissions for the socket file
= 666
#the variable that holds a flask application inside the module imported at line #6
callable = app
#location of log files
logto = /var/log/uwsgi/%n.log

then the bit where it all goes wrong:

uwsgi —ini /var/www/heating/heating_uwsgi.ini

here I get the error message uwsgi: invalid option – ‘n’ getopt_long() error

Can any body point me in the right direction Kind regards Paul

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Props to the person who mentioned there should be – vs -. I had the same error and that solved my problem.

Paul, I’m by no means an expert on these types of things. But I have suffered countless hours installing servers, backends, etc. on linux systems. The error I see there is:

ImportError: No module named flask

You should verify that flask is installed.

apt-get install uwsgi-plugin-python3

helped in my case

Hi again!

I have just look in the log file and found this:

WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 2.7.13 (default, Nov 24 2017, 17:33:09)  [GCC 6.3.0 20170516]
Set PythonHome to /var/www/heating/venv
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x890b68
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 64392 bytes (62 KB) for 1 cores
*** Operational MODE: single process ***
added /var/www/heating/ to pythonpath.
Traceback (most recent call last):
  File "/var/www/heating/", line 1, in <module>
    from flask import Flask
ImportError: No module named flask
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 4377, cores: 1)
--- no python application found, check your startup logs for errors ---
[pid: 4377|app: -1|req: -1/1] () {42 vars in 626 bytes} [Thu Apr  5 19:16:56 2018] GET / => generated 21 bytes in 9 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

Does this mean anything to anybody?

Thanks for all your Help Regards Paul