SalvorHardin
SalvorHardin

Reputation: 55

Internal Server Error running Flask on gcloud using Docker

I'm trying to run a python app on gcloud and everything works fine until I add "from flask_sqlalchemy import SQLAlchemy" to my file. The error I get is "Internal server error"

This is my Dockerfile

FROM tiangolo/uwsgi-nginx-flask:python3.6
MAINTAINER 
COPY ./app /app
RUN apt-get update
RUN apt-get --upgrade install -y nmap curl nano dialog net-tools python-pip python3-pip 
python-dev build-essential python-distribute python3 mysql-server
RUN pip install --upgrade pip flask Flask-PyMongo Flask-WTF SQLAlchemy mysqlclient

And this the part where I import the extensions

from flask import Flask, render_template, flash, redirect, url_for, session, request
from flask_pymongo import PyMongo
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from functools import wraps
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime

Upvotes: 0

Views: 623

Answers (1)

Andrew Graham-Yooll
Andrew Graham-Yooll

Reputation: 2258

You should install pip install Flask-SQLAlchemy not SQLAlchemy. They are different and you are importing from Flask-SQLAlchemy.

Therefore change this in your Dockerfile:

RUN pip install --upgrade pip flask Flask-PyMongo Flask-WTF Flask-SQLAlchemy mysqlclient

Upvotes: 1

Related Questions