mah 7 anni fa
parent
commit
785488c2e1
6 ha cambiato i file con 99 aggiunte e 1 eliminazioni
  1. 32 0
      pyrot_nginx.conf
  2. 21 0
      pyrot_uwsgi.ini
  3. 17 0
      requirements.txt
  4. 11 0
      uwsgi-hello-world-test.py
  5. 17 0
      uwsgi_params
  6. 1 1
      webgui/webgui/settings.py

+ 32 - 0
pyrot_nginx.conf

@@ -0,0 +1,32 @@
+# the upstream component nginx needs to connect to
+upstream django {
+    server unix:///opt/rotbot-env/pyRot/webgui.sock; # For production file socket
+    # server 127.0.0.1:8001; # Web port socket for use with uwsgi-hello-world-test.py
+}
+
+# configuration of the server
+server {
+    # the port your site will be served on
+    listen      8000;
+    # the domain name it will serve for
+    server_name _; # substitute your machine's IP address or FQDN
+    charset     utf-8;
+
+    # max upload size
+    client_max_body_size 75M;   # adjust to taste
+
+    # Django media
+    #location /media  {
+    #    alias /path/to/your/mysite/media;  # your Django project's media files - amend as required
+    #}
+
+    location /static {
+        alias /srv/www/static; # your Django project's static files - amend as required
+    }
+
+    # Finally, send all non-media requests to the Django server.
+    location / {
+        uwsgi_pass  django;
+        include     /opt/rotbot-env/pyRot/uwsgi_params; # the uwsgi_params file you installed
+    }
+}

+ 21 - 0
pyrot_uwsgi.ini

@@ -0,0 +1,21 @@
+[uwsgi]
+
+# Django-related settings
+# the base directory (full path)
+chdir           = /opt/rotbot-env/pyRot/webgui
+# Django's wsgi file
+module          = webgui.wsgi
+# the virtualenv (full path)
+home            = /opt/rotbot-env
+
+# process-related settings
+# master
+master          = true
+# maximum number of worker processes
+processes       = 10
+# the socket (use the full path to be safe
+socket          = /opt/rotbot-env/pyRot/webgui.sock
+# ... with appropriate permissions - may be needed
+ chmod-socket    = 666
+# clear environment on exit
+vacuum          = true

+ 17 - 0
requirements.txt

@@ -0,0 +1,17 @@
+Django==2.0.2
+inflect==0.2.5
+irc==16.2
+jaraco.classes==1.4.3
+jaraco.collections==1.5.2
+jaraco.functools==1.17
+jaraco.itertools==2.1
+jaraco.logging==1.5.1
+jaraco.stream==1.1.2
+jaraco.text==1.9.2
+more-itertools==4.1.0
+postgres==2.2.1
+psycopg2==2.7.3.2
+pytz==2017.3
+six==1.11.0
+tempora==1.10
+uWSGI==2.0.15

+ 11 - 0
uwsgi-hello-world-test.py

@@ -0,0 +1,11 @@
+# After creating virtual env & pip install uwsgi.
+
+# Client-uwsgi test:
+# Run with uwsgi --http :8000 --wsgi-file uwsgi-hello-world-test.py
+
+# Client-nginx-uwsgi test:
+# uwsgi --socket :8001 --wsgi-file uwsgi-hello-world-test.py
+
+def application(env, start_response):
+    start_response('200 OK', [('Content-Type','text/html')])
+    return [b"Hello World"] # python3

+ 17 - 0
uwsgi_params

@@ -0,0 +1,17 @@
+
+uwsgi_param  QUERY_STRING       $query_string;
+uwsgi_param  REQUEST_METHOD     $request_method;
+uwsgi_param  CONTENT_TYPE       $content_type;
+uwsgi_param  CONTENT_LENGTH     $content_length;
+
+uwsgi_param  REQUEST_URI        $request_uri;
+uwsgi_param  PATH_INFO          $document_uri;
+uwsgi_param  DOCUMENT_ROOT      $document_root;
+uwsgi_param  SERVER_PROTOCOL    $server_protocol;
+uwsgi_param  REQUEST_SCHEME     $scheme;
+uwsgi_param  HTTPS              $https if_not_empty;
+
+uwsgi_param  REMOTE_ADDR        $remote_addr;
+uwsgi_param  REMOTE_PORT        $remote_port;
+uwsgi_param  SERVER_PORT        $server_port;
+uwsgi_param SERVER_NAME         $server_name;

+ 1 - 1
webgui/webgui/settings.py

@@ -25,7 +25,7 @@ SECRET_KEY = 'z$7@t8*hjcrh@-#-7x*xakolm5z)0*c!+&(dbvd5jmw1sef95u'
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
 
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ['*']
 
 
 # Application definition