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

Created .env file and updated Readme #147

Closed
wants to merge 1 commit into from
Closed
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
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
[![Build Status](https://travis-ci.com/scorelab/TensorMap.svg?branch=master)](https://travis-ci.com/scorelab/TensorMap) [![Join the chat at https://gitter.im/scorelab/TensorMap](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scorelab/TensorMap)
[![Build Status](https://travis-ci.com/scorelab/TensorMap.svg?branch=master)](https://travis-ci.com/scorelab/TensorMap) [![Join the chat at https://gitter.im/scorelab/TensorMap](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scorelab/TensorMap)
[![HitCount](http://hits.dwyl.com/scorelab/TensorMap.svg)](http://hits.dwyl.com/scorelab/TensorMap)



# TensorMap

TensorMap is a web application that will allow the users to create machine learning algorithms visually. TensorMap supports reverse engineering of the visual layout to a Tensorflow implementation in preferred languages. The goal of the project is to let the beginners play with machine learning algorithms in Tensorflow without less background knowledge about the library. For more details about the project, read our [project wiki.](https://github.com/scorelab/TensorMap/wiki)

## Getting Started

Follow these steps to set up TensorMap on your local machine.

First clone this repo by running

```bash

git clone https://github.com/scorelab/TensorMap.git
```````````````````````````
```

### Setting up Frontend

#### Prerequisites
* Node.js
* Yarn
* Npm

- Node.js
- Yarn
- Npm

```bash
cd TensorMap
Expand Down Expand Up @@ -54,13 +55,15 @@ mysql -u <user> -p
CREATE DATABASE tensormap;
```

Then in the '__init__' file that is inside the 'app' folder, replace the database connection string with your username and password
Create a .env file based on the format provided in .envsample file, add your database connection string and secret

```bash
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://<user>:<password>@localhost/tensormap"
DATABASE_URI=mysql://<user>:<password>@localhost:<portnumber>/tensormap
SECRET_KEY=secret
```

Next, restore the sql dump

```bash
mysql -u {user} -p -Dtensormap < {path-to-dump-file}/dump.sql
```
Expand All @@ -73,9 +76,9 @@ python run.py

## Built With

* [Reactjs](https://reactjs.org/docs/getting-started.html) : Frontend
* [Flask](http://flask.pocoo.org/) : Backend
* [TensorFlow - Keras](https://www.tensorflow.org/) : Model implemetation
- [Reactjs](https://reactjs.org/docs/getting-started.html) : Frontend
- [Flask](http://flask.pocoo.org/) : Backend
- [TensorFlow - Keras](https://www.tensorflow.org/) : Model implemetation

## Contributing

Expand Down
2 changes: 2 additions & 0 deletions tensormap-server/.envsample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URI=mysql://<user>:<password>@localhost:<portnumber>/tensormap
SECRET_KEY=secret
3 changes: 3 additions & 0 deletions tensormap-server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,7 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# Misc
/flask_session

# End of https://www.gitignore.io/api/linux,macos,python,windows,pycharm,visualstudiocode
9 changes: 7 additions & 2 deletions tensormap-server/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS, cross_origin
from flask_session import Session
from dotenv import load_dotenv
import os

socketio = SocketIO()
Expand All @@ -12,12 +13,16 @@
def create_app(debug=False):

app = Flask(__name__)

# Load environment variables
load_dotenv()

app.debug = debug
app.config['SESSION_TYPE'] = 'filesystem'
app.config['SECRET_KEY'] = 'secret'
app.config['SECRET_KEY'] = os.getenv("SECRET_KEY")
app.config['USE_PERMANENT_SESSION'] = True
# app.config['SECRET_KEY'] = os.urandom(25)
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://root:pass@localhost/tensormap"
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv("DATABASE_URI")
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

from .resources import main
Expand Down