Răsfoiți Sursa

Attempted to get apache server running with wsgi (not currently working)

Will Piper 4 ani în urmă
părinte
comite
dbb766af42
6 a modificat fișierele cu 26 adăugiri și 7 ștergeri
  1. 16 0
      CustomBuild.conf
  2. 0 0
      __init__.py
  3. 1 2
      app.py
  4. 8 0
      app.wsgi
  5. 1 1
      templates/index.html
  6. 0 4
      wsgi.py

+ 16 - 0
CustomBuild.conf

@@ -0,0 +1,16 @@
+<VirtualHost *:80>
+     # Add machine's IP address (use ifconfig command)
+     ServerName 127.0.0.1
+     # Give an alias to to start your website url with
+     WSGIDaemonProcess app user=will group=will threads=5
+     WSGIScriptAlias /CustomBuild /home/will/GitHub/CustomBuild/app.wsgi
+     <Directory /home/will/GitHub/CustomBuild/>
+     		# set permissions as per apache2.conf file
+            Options FollowSymLinks
+            AllowOverride None
+            Require all granted
+     </Directory>
+     ErrorLog ${APACHE_LOG_DIR}/error.log
+     LogLevel warn
+     CustomLog ${APACHE_LOG_DIR}/access.log combined
+</VirtualHost>

+ 0 - 0
__init__.py


+ 1 - 2
app.py

@@ -202,7 +202,7 @@ import optparse
 parser = optparse.OptionParser("app.py")
 
 parser.add_option("", "--basedir", type="string",
-                  default="..", help="base directory")
+                  default="/home/will/GitHub", help="base directory")
 cmd_opts, cmd_args = parser.parse_args()
                 
 # define directories
@@ -283,7 +283,6 @@ def generate():
         if os.path.isdir(outdir):
             app.logger.info('Build already exists')
         else:
-            app.logger.info('Creating ' + outdir)
             create_directory(outdir)
             # create build.log
             build_log_info = ('Vehicle: ' + request.form['vehicle'] +

+ 8 - 0
app.wsgi

@@ -0,0 +1,8 @@
+#! /usr/bin/python3
+
+import logging
+import sys
+logging.basicConfig(stream=sys.stderr)
+sys.path.insert(0, '/home/will/GitHub/CustomBuild')
+from app import app as application
+application.secret_key = 'key'

+ 1 - 1
templates/index.html

@@ -7,7 +7,7 @@
 
         <p>Please select the required options for the reduced firmware build.</p>
 
-        <form action="/generate" method="post">
+        <form action="/CustomBuild/generate" method="post">
             <label for="vehicle">Choose a vehicle:</label>
             <select name="vehicle">
                 {% for vehicle in get_vehicles() %}

+ 0 - 4
wsgi.py

@@ -1,4 +0,0 @@
-from app import app
-
-if __name__ == "__main__":
-    app.run()