Skip to content

Commit

Permalink
Merge pull request #709 from xlight05/issue-mysql-error
Browse files Browse the repository at this point in the history
Add console logging for better debugging as developer
  • Loading branch information
vivonk authored Mar 24, 2019
2 parents 6b9df6c + 99ccd5c commit 4e74549
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,46 @@ Use python 3 instead of Python 2
Bassa has 4 main compoenents,
1. Database
2. Bassa API
3. Bassa UI
4. aria2
3. aria2
4. Bassa UI


## Database Setup

1. Type below in a MySql terminal.
1.Type below in a MySql terminal.

```
create database Bassa
```

2. Type below in the root of project.
2.Type below in the root of project.

```
mysql -u root -p Bassa < Bassa.sql
```

3. Open components/core/DBCon.py and setup database username and password.


3.Open components/core/DBCon.py and setup database username and password.
```
_db=MySQLdb.connect("db", os.environ.get('YOUR_DB_USERNAME'), os.environ.get('YOUR_DB_PASSWORD'), os.environ.get('Bassa'))
```
If you don't have environment variables setup, you can use the following line with hard coded values for testing purposes
```
_db=MySQLdb.connect(host="localhost", user="YOUR_DB_USERNAME", passwd="YOUR_DB_PASSWORD",db= "Bassa")
```
## Bassa API
```
$ cd components/core/
$ python3 Main.py
```
![python3main](https://user-images.githubusercontent.com/28682735/35194408-2fce9136-fed9-11e7-80e6-fac5e6f54bc7.gif)

## Run aria2
run `aria2c --enable-rpc`

Read more on installing `aria2` [here](https://aria2.github.io/manual/en/html/README.html)


![aria2c](https://user-images.githubusercontent.com/28682735/35193755-709e92ee-fecd-11e7-8dd0-412304853c8c.gif)

## Bassa UI

Expand All @@ -106,16 +118,6 @@ In the first time you log in, the credentials would be as follows.

![bassaui](https://user-images.githubusercontent.com/28682735/35193753-667c7e0c-fecd-11e7-918f-13ce1d00d055.gif)


## Make sure you have aria2 installed.
run `aria2c --enable-rpc`

Read more on installing `aria2` [here](https://aria2.github.io/manual/en/html/README.html)


![aria2c](https://user-images.githubusercontent.com/28682735/35193755-709e92ee-fecd-11e7-8dd0-412304853c8c.gif)


## Running Tests

### API Tests
Expand Down
15 changes: 13 additions & 2 deletions components/core/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ def main():


if __name__ == '__main__':
logging.basicConfig(filename="./debug-server.log", level=logging.DEBUG)
logging.warning("INFO: Bassa starting")
logging.basicConfig(
filename="./debug-server.log",
level=logging.DEBUG,
format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M'
)

console = logging.StreamHandler()
formatter = logging.Formatter('%(levelname)-8s %(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)

logging.info("Bassa starting")
check_conf_availability()
main()

0 comments on commit 4e74549

Please sign in to comment.