Coder Social home page Coder Social logo

papismurf / betbuddy Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 3.39 MB

Friendly Betting App - Bet on Anything - We Bet You'll have fun.

Python 3.62% Dockerfile 0.04% CSS 25.19% JavaScript 33.53% Java 0.79% TypeScript 34.23% Shell 1.22% Objective-C 1.38%

betbuddy's Introduction

BetBud

Build Status Coverage Status

BetBud is a Django 2 + React Native Peer-to-Peer Betting App

Requires Python 3.6+ and Django 2.1+

Configuration

  • Django 2.0 and React Native
  • Django Rest Framework API
  • Django backend handling business logic and authentication, with views.py and models.py etc.
  • Base page template with,
    • Top navbar with menu, sign up/log in, and user profile
    • Page content
    • Footer
  • Home, About, Contact, Contribute pages
  • Sign up/log in (by username or email)
  • Reset/change password
  • Update userprofile
  • Basic tests
  • Logging
  • Project version as global context variable
  • Daily backups
  • Dockerfile config
  • gcloud config
  • coveralls config
  • django-debug-toolbar

TODO

  • Create/load demo data

Installation (Linux)

Get the code and enter the project directory,

git clone https://github.com/papismurf/BetBuddy.git
cd BetBuddy

Install dependencies that you will need,

apt-get install virtualenv

or

pip install virtualenv

Make sure you have a recent version of pip,

pip install --upgrade pip

Create a virtual environment,

virtualenv -p python3 env

Activate the virtualenv (always do this before working on the project),

source env/bin/activate

Install python packages in the local env,

pip install -r requirements.txt

Generate a local_settings.py file from the example,

python create_local_settings.py

Create a database (default is sqlite),

python manage.py migrate

Create a superuser (optional)

This allows you to login at the website as superuser and view the admin page,

python manage.py createsuperuser

Run a developement webserver

Run the Django dev web server in the virtualenv (don't forget to active the virtualenv),

python manage.py runserver

The website is now available at http://127.0.0.1:8000 and admin http://127.0.0.1:8000/admin.

Configuration (optional)

local_settings.py

The local settings are defined in website/local_settings.py. These are not under version control and you are free change these for your personal needs. This is also the place for secret settings. An example, on which this file is based, is found in website/local_settings_example.py.

Daily backups (cronjob)

This project has a django-cronjob that makes daily backups of the raw database (includes everything), and a json dump of the data. These are defined in website/cron.py. The location of the backup files is defined in website/local_settings.py. Create the following cronjob (Linux) to kickstart the django-cron jobs,

$ crontab -e
*/5 * * * * source /home/<username>/.bashrc && source /home/<path-to-project>/env/bin/activate && python /home/<path-to-project>/website/manage.py runcrons > /home/<path-to-project>/log/cronjob.log

Testing

Run all tests,

python manage.py test

Run specific tests (example),

python manage.py test website.tests.TestCaseAdminLogin

Logging

There are 3 log files (debug.log, error.log, django.log) available, with different log levels and for different applications. The log files are found in the log directory of the project. The log statements contain the time, log level, file, class, function name and line.

The log something, create a logger at the top of you python file,

import logging
logger = logging.getLogger(__name__)

then create a log statement as follows,

logger.debug('an info log message')
logger.info('an info log message')
logger.warning('a warning log message')
logger.error('a error log message')
logger.exception(exception_object)

betbuddy's People

Contributors

djbrown89 avatar papismurf avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

praneybehl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.