Skip to content

Commit

Permalink
Merge pull request #36 from DoRTaL94/project-restructure
Browse files Browse the repository at this point in the history
User Management backend - Base - Project restructure
  • Loading branch information
lmilbaum authored May 3, 2020
2 parents 9ea9277 + 64ec2e4 commit 932511b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
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"
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.

0 comments on commit 932511b

Please sign in to comment.