Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
apache lib-wsgi 403 Forbidden

The only way I can run apps on my local machine is by using apache and lib-wsgi. I have installed all the relevent packages including encodings but in my browser I am getting a 403 Forbidden error and in my error logs I am getting this:

AH00051: child pid 28900 exit signal Aborted (6), possible coredump in /etc/apache2
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

I have run

sudo chmod a+x on my files

and

sudo chmod +rw on my folders.

and

sudo chown on my working directories

What do I need to do to get this working?

These are my files:

.conf file:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/demo1
        ServerName 127.0.0.1
        # Give an alias to to start your website url with
     WSGIDaemonProcess application python-home=/var/www/html/demo1
     WSGIProcessGroup flask-hello-app
     WSGIApplicationGroup %{GLOBAL}
     WSGIScriptAlias /demo1 /var/www/html/demo1/flask-hello-app.wsgi
     <Directory /var/www/html/demo1/>
                # set permissions as per apache2.conf file
            Options FollowSymLinks
            # AllowOverride None
            # Require all granted
            Order deny,allow
            Allow from all
     </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

flask-hello-app.wsgi

#!/uae/bin/python3
import logging
import sys
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0, '/var/www/html/demo1/')
from application import app as application
application.secret_key = 'super_secret_key'

flask-hello-app.py

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import os

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg2://postgres:F00tBall@127.0.0.1:5432/example'
db = SQLAlchemy(app)

class Person(db.Model):
    __tablename__ = 'persons'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(), nullable=False)

db.create_all()

@app.route('/')
def index():
    return 'Hello '

if __name__ == '__main__':
    app.run()

I really need to know how to get this working.

Thanks.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda