Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Management backend - Base - Project restructure #36

Merged
merged 5 commits into from
May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
FLASK_PORT=5000
POSTGRESQL_PORT=5432

Vagrant.configure("2") do |config|

config.vm.box = "ubuntu/bionic64"
config.vm.provision :shell, path: "setup.sh"
config.vm.network :forwarded_port, guest: FLASK_PORT, host: FLASK_PORT
config.vm.network :forwarded_port, guest: POSTGRESQL_PORT, host: POSTGRESQL_PORT
config.vm.network "private_network", type: "dhcp"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot to mention this change in your PR description

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, they way you describe it there, tells people what you did - which should generally be obvious from the code, but not why you did it which is the one thing that code can never tell you on its own...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay I didn't think about it, thank you. I'll rewrite it.

Copy link
Collaborator Author

@DoRTaL94 DoRTaL94 Apr 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ifireball I referenced your comment in our discussion in the old PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll personally I prefer to write a short summary of what I want people to know, instead of sending then to look for it in a discussion thread, but that is not a reason to block a PR.

config.vm.provider "virtualbox" do |v|
v.gui = false
v.name = "Edison_test"
Expand All @@ -14,3 +11,11 @@ Vagrant.configure("2") do |config|
end

end

# Fixes a dhcp configuration conflict of the private network.
# Issue: https://github.com/hashicorp/vagrant/issues/8878
class VagrantPlugins::ProviderVirtualBox::Action::Network
def dhcp_server_matches_config?(dhcp_server, config)
true
end
end
8 changes: 8 additions & 0 deletions edison/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os

from flask import Flask


# Put app here so the entire app could import it.
app = Flask(__name__)
basedir = os.path.abspath(os.path.dirname(__file__))
7 changes: 5 additions & 2 deletions flask_init.py → edison/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from flask import Flask, render_template
import edison

app = Flask(__name__)
from flask import render_template


app = edison.app

@app.route("/")
def index():
Expand Down
File renamed without changes
File renamed without changes.
8 changes: 5 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

FLASK_PORT=5000

echo "updating apt before installation"
sudo apt-get update

Expand All @@ -15,6 +17,6 @@ sudo apt-get install -y postgresql postgresql-contrib
echo "install requirements"
pip3 install -r /vagrant/requirements.txt

echo "running flask_init.py"
export FLASK_APP=/vagrant/flask_init.py
python3 -m flask run --host=0.0.0.0 >> /vagrant/log.log 2>&1 &
echo "running app.py"
export FLASK_APP=/vagrant/edison/app.py
flask run -h 0.0.0.0 -p $FLASK_PORT >> /vagrant/edison/app.log 2>&1 &
File renamed without changes.