提交 efc54e0f 编写于 作者: M Maxime Beauchemin

Preparing pypi package

上级 d419279d
*.pyc
*.db
tmp
panoramix_config.py
local_config.py
env
app.db
......@@ -61,35 +61,17 @@ Installation
Follow these few simple steps to install Panoramix
```
# Clone the github repo
git clone https://github.com/mistercrunch/panoramix.git
# Get in that fresh new folder
cd panoramix
# You may want to create a python virtualenv
# virtualenv env
# source env/bin/activate
# pip install -r requirements.txt
# If you don't use a virtualenv, you'll have to sudo to install the reqs
sudo pip install -r requirements.txt
# Install panoramix
pip install panoramix
# Edit config.py, and read through the settings
# Note that alternatively, you can create a ``local_config.py`` and put it
# somewhere in your PYTHONPATH. The variables declared local_config.py
# will override the ones in ``config.py``, and won't create issues when
# you need to ``git pull`` the latest version of panoramix
vim config.py
# Create an admin user
fabmanager create-admin --app panoramix
# Create an admin account, the app will ask for username/password, ...
# This feature is out of Flask App Builder, the framework I used to build
# Panoramix
fabmanager create-admin
# Clone the github repo
git clone https://github.com/mistercrunch/panoramix.git
# Start the web server
python run.py
panoramix
```
After installation, you should be able to point your browser to the right
......@@ -101,6 +83,42 @@ your datasources for Panoramix to be aware of, and they should show up in
Configuration
-------------
To configure your application, you need to create a file (module)
`panoramix_config.py` and make sure it is in your PYTHONPATH. Here are some
of the parameters you can copy / paste in that configuration module:
```
#---------------------------------------------------------
# Panoramix specifix config
#---------------------------------------------------------
ROW_LIMIT = 5000
WEBSERVER_THREADS = 8
PANORAMIX_WEBSERVER_PORT = 8088
#---------------------------------------------------------
#---------------------------------------------------------
# Flask App Builder configuration
#---------------------------------------------------------
# Your App secret key
SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h'
# The SQLAlchemy connection string.
SQLALCHEMY_DATABASE_URI = 'sqlite:///tmp/panoramix.db'
# Flask-WTF flag for CSRF
CSRF_ENABLED = True
# Whether to run the web server in debug mode or not
DEBUG = True
```
This file also allows you to define configuration parameters used by
Flask App Builder, the web framework used by Panoramix. Please consult
the [Flask App Builder Documentation](http://flask-appbuilder.readthedocs.org/en/latest/config.html) for more information on how to configure Panoramix.
* From the UI, enter the information about your clusters in the
``Admin->Clusters`` menu by hitting the + sign.
......
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = migrations
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# max length of characters to apply to the
# "slug" field
#truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; this defaults
# to help/versions. When using multiple version
# directories, initial revisions must be specified with --version-path
# version_locations = %(here)s/bar %(here)s/bat help/versions
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
sqlalchemy.url = scheme://localhost/panoramix
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
......@@ -10,7 +10,7 @@ logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
app.config.from_object('config')
app.config.from_object('panoramix.config')
db = SQLA(app)
class MyIndexView(IndexView):
......@@ -22,4 +22,4 @@ appbuilder = AppBuilder(
get_session = appbuilder.get_session
from app import views
from panoramix import views
#!/usr/bin/env python
from panoramix import app, config
from subprocess import Popen
if __name__ == "__main__":
if config.DEBUG:
app.run(
host='0.0.0.0',
port=int(config.PANORAMIX_WEBSERVER_PORT),
debug=True)
else:
cmd = (
"gunicorn "
"-w 8 "
"-b 0.0.0.0:{config.PANORAMIX_WEBSERVER_PORT} "
"panoramix:app").format(**locals())
print("Starting server with command: " + cmd)
Popen(cmd, shell=True).wait()
......@@ -124,6 +124,6 @@ IMG_UPLOAD_URL = '/static/uploads/'
#APP_THEME = "yeti.css"
try:
from local_config import *
from panoramix_config import *
except:
pass
......@@ -22,7 +22,7 @@ import sqlparse
import requests
import textwrap
from app import db, get_session, utils
from panoramix import db, get_session
QueryResult = namedtuple('namedtuple', ['df', 'query', 'duration'])
......
import config
from datetime import datetime
import parsedatetime
from app import db
def parse_human_datetime(s):
......
from datetime import datetime
import logging
import json
import logging
from flask import request, redirect, flash, Response
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask.ext.appbuilder import ModelView, CompactCRUDMixin, BaseView, expose
from app import appbuilder, db, models, viz, utils, app, get_session
from flask.ext.appbuilder.security.decorators import has_access, permission_name
import config
from flask.ext.appbuilder.security.decorators import has_access
from pydruid.client import doublesum
from wtforms.validators import ValidationError
from flask.ext.appbuilder.actions import action
from panoramix import appbuilder, db, models, viz, utils, app
def validate_json(form, field):
try:
......
......@@ -2,12 +2,11 @@ from datetime import datetime
from flask import flash, request
import pandas as pd
from collections import OrderedDict
from app import utils
from app.highchart import Highchart, HighchartBubble
from panoramix import utils
from panoramix.highchart import Highchart, HighchartBubble
from wtforms import Form, SelectMultipleField, SelectField, TextField
import config
import logging
from pydruid.utils.filters import Dimension, Filter
CHART_ARGS = {
......
from app import app
import config
from subprocess import Popen
if config.DEBUG:
app.run(
host='0.0.0.0',
port=int(config.PANORAMIX_WEBSERVER_PORT),
debug=True)
else:
cmd = (
"gunicorn "
"-w 8 "
"-b 0.0.0.0:{config.PANORAMIX_WEBSERVER_PORT} "
"app:app").format(**locals())
print("Starting server with command: " + cmd)
Popen(cmd, shell=True).wait()
from setuptools import setup, find_packages
version = '0.2'
setup(
name='panoramix',
description=(
"A interactive data visualization platform build on SqlAlchemy "
"and druid.io"),
version=version,
packages=find_packages(),
package_data={'': ['panoramix/alembic.ini']},
include_package_data=True,
zip_safe=False,
scripts=['panoramix/bin/panoramix'],
install_requires=[
'flask-appbuilder>=1.4.5',
'flask-alembic>=1.2.1',
'gunicorn>=19.3.0',
'pandas>=0.16.2',
'pydruid>=0.2.2',
'parsedatetime>=1.5',
'python-dateutil>=2.4.2',
'requests>=2.7.0',
'sqlparse>=0.1.16',
],
author='Maxime Beauchemin',
author_email='maximebeauchemin@gmail.com',
url='https://github.com/mistercrunch/panoramix',
download_url=(
'https://github.com/mistercrunch/panoramix/tarball/' + version),
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册