Comments (11)
The SERVER_NAME
variable is set based on your server settings from what I can understand. I am not sure exactly what this means for Amazon EC2. But open a PR with your solution and I'll take a look at it and see whats the best way to integrate it. Just as a general question, are you running your application with the FLASK_CONFIG
env var set to production
?
from flask-base.
I have the environment variable set to development.
Isn't the SERVER_NAME supposed to be set in the env file? The server setup I'm running is a nginx server pointing upstream to this (flask-base) server instance which I run using the Foreman config:
redis: redis-server
web: python -u manage.py runserver --host 127.0.0.1 --port 8000
worker: python -u manage.py run_worker
I tried it with the host defined like that and without it with the same results.
from flask-base.
just wondering. if you set the environment variable FLASK_CONFIG=production
does that change anything? sorry for being late getting to this, had a few midterms this week.
from flask-base.
Sorry about taking so long to respond.
I tried setting the FLASK_CONFIG=production flag in the .env file with the other flask parameters and it doesn't appear to be changing anything other than now the server gives me a RaygunProvider error: ApiKey not set, errors will not be transmitted.
Shut down the server and restarted it with the same issue. The only method I have to work around this issue is to set the external flag in url_for() to false and then have a string for my server name that I append with the internal URL. This is sloppy and I would like to have flask-base give me the name of the website if possible. Even if I have to pre-load it into the env.py file or elsewhere.
from flask-base.
Hey Matt,
no problem on taking a while to respond. So I have tried to replicate this issue on my personal docker instance running on Digital ocean and it consistently puts my server domain in emails. If I manage to replicate the issue (or if someone else mentions it), I will merge the fix into the code base...but until then, a more maintainable fix would be to go to your config.env
(or .env
if you are using an older version of flask-base) file and add the line
SERVER_NAME=http://yourdomainnamehere.blah
Inside of config.py
after line 58 add
SERVER_NAME = os.environ.get('SERVER_NAME') or 'http://localhost:5000'
and make sure that you change _external
mentions to True
instead of False
from flask-base.
I followed your instructions and I am unable to view any of the website pages after restarting the server.
My configuration is as follows:
-
Using foreman to load the website,rq,redis:
redis: redis-server
web: python -u manage.py runserver --port 8001
worker: python -u manage.py run_worker -
Instance is run on an EC2 amazon instance (ubuntu 14.04)
-
Running in app.config development mode
-
Nginx is handling SSL with letsencrypt and passing data upstream to the app running on port 8001.
If you need clarification or additional information I will see what I can provide.
from flask-base.
sorry change the line to
SERVER_NAME = os.environ.get('SERVER_NAME') or 'localhost:5000'
OR for a slightly more managable configuration
on line 59:
SERVER_NAME = 'localhost:5000'
somewhere under ProductionConfig
add
SERVER_NAME = os.environ.get('SERVER_NAME')
this fix will run on localhost 5000 in development mode and run on the actual server name when you set FLASK_CONFIG to production
i think that should work. I don't recall whether SERVER_NAME
will need http://
in front of it...most likely not now that i think about it.
from flask-base.
I tried your suggestions and it didn't work. Do I have to run the website on port 5000 in order for this to work? If so how do I change that to port 8001?
The website runs but I also get 404s for all of the webassets_external; How do I fix that?
from flask-base.
So on docker, you need to bind your local port (flask sets this to 5000) to whatever your external port will be.
from flask-base.
I'm not working with docker, the server is hosted on AWS. I have no idea how docker got added to this conversation.
After trying your suggestions I still can't get the server to issue confirmation links with the server name I give it or even the port number.
from flask-base.
sorry about the docker thing, was working on a docker project while i wrote that.
but since I haven't been able to replicate the issue on my end, the only thing i can think of is to have a separate environment variable just for your emailing URL (dont use SERVER_NAME
since that is reserved by Flask for handling url routing etc) or just hardcoding it in as you said in your original message. I don't have a ton of experience launching things on AWS so I am not the best person to reach out to about this.
Also about your question regarding whether it has to be on port 5000, you can change that by explicitly adding the runserver command in manager.py as shown here http://stackoverflow.com/questions/34824988/run-app-from-flask-migrate-manager
from flask-base.
Related Issues (20)
- Looking for help creating docker-compose.yml
- migrate and upgrade HOT 2
- Making flask-base a template HOT 1
- Installing on Windows? Unable to get redis installation HOT 2
- how to add mailgun credentials? HOT 2
- install error HOT 5
- Heroku bundling issues HOT 2
- celery integration HOT 2
- Docker file for deployment HOT 1
- Adding Docker compose
- Icon documentation HOT 2
- error in showing account/unconfirmed.html
- SyntaxError: invalid syntax while running Flask in venv HOT 6
- docker should work out of the box? HOT 6
- Why is SSL disabled by default in production? HOT 1
- How to execute the following commands on Windows HOT 1
- User authentication not working in mobile view HOT 6
- Tests should export logs in order to improve pipeline integration HOT 1
- Freshly cloned docker-compose is giving error ModuleNotFoundError: No module named 'flask._compat'
- ModuleNotFoundError: No module named 'flask.ext' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-base.