Giter Club home page Giter Club logo

vj4's Introduction

VJ4

Build Status Code Climate Dependency Status GitHub license

Next generation of Vijos, built with asyncio on Python 3.5.

Prerequisites

Install requirements

In the root of the repository, where requirements.txt and package.json locates:

python3.5 -m pip install -r requirements.txt
npm install   # cnpm install

You don't need root privilege to run npm install. It installs stuffs in the project directory.

You may want to use cnpm and tuna if you are in China. Make sure to use cnpm by adding alias to npm instead of installing cnpm cli-tool.

IP Geo-Location

To enable IP geo-location translation, you need to obtain a MaxMind GeoLite City DB and put it in the project root directory:

curl "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz" | gunzip -c > GeoLite2-City.mmdb

You may also want to install libmaxminddb for higher performance.

Development

In the root of the repository:

npm run generate:icon
npm run generate:constant
npm run generate:locale
npm run build  # to watch modifications: npm run watch
python3.5 -m vj4.server --debug

As an intuitive example, you may want to add a first user and problem to start:

alias pm="python3.5 -m"
pm vj4.model.user add -1 icebox 12345 [email protected]
pm vj4.model.adaptor.problem add system "Dummy Problem" "# It *works*" -1 777

You need to run rank script on a regular basis to maintain correct ranks for all users:

pm vj4.job.rank rank

After Modifying Icons (vj4/ui/misc/icons)

  1. npm run generate:icon

After Modifying Constants (vj4/ui/constant)

  1. npm run generate:constant
  2. Restart server

After Modifying Locales (vj4/locale)

  1. npm run generate:locale
  2. Restart server

Production

npm run generate:icon
npm run generate:constant
npm run generate:locale
npm run build:production
python3.5 -OO -m vj4.server --listen=unix:/var/run/vj4.sock
  • Set --listen (default: http://127.0.0.1:8888) to listen on a different address.
  • Set --prefork (default: 1) to specify the number of worker processes.
  • Set --ip-header (default: X-Forwarded-For) to use IP address in request headers.
  • Set --url-prefix (default: https://vijos.org) to set URL prefix.
  • Set --cdn-prefix (default: /) to set CDN prefix.
  • Set --smtp-host, --smtp-user and --smtp-password to specify a SMTP server.
  • Set --db-host (default: localhost) and/or --db-name (default: test) to use a different database.

Notes

Have fun!

Maximum line width: 100

Indentation: 2 spaces

JavaScript Style Guide

References

vj4's People

Contributors

breezewish avatar twd2 avatar iceboy233 avatar blackbbc avatar joshoy avatar sxkdz avatar

Watchers

James Cloos avatar Shibo Lyu avatar

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.