initial commit

This commit is contained in:
Oleg Podsadny 2013-06-05 22:44:17 +02:00
parent 1e7b89d6c7
commit 3df30bf766
21 changed files with 231 additions and 0 deletions

47
.gitignore vendored Normal file
View File

@ -0,0 +1,47 @@
*.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
_build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.cache
.ropeproject
# Sublime
/*.sublime-*
# virtualenv
/.Python
/lib
/include
/src

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: python
python:
- "2.6"
- "2.7"
# command to install dependencies
install: "python setup.py develop"
# command to run tests
script: python setup.py test

19
manage.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python
from opster import command, dispatch
from .admin import admin
from .shop import shop
@command()
def runadmin(host=('a', '127.0.0.1', 'bind address')):
admin.run(debug=True, host=host)
@command()
def runshop(host=('a', '127.0.0.1', 'bind address')):
shop.run(debug=True, host=host)
if __name__ == '__main__':
dispatch()

View File

@ -0,0 +1,13 @@
from flask import Flask
from .settings import TEMPLATES_ROOT, MEDIA_ROOT
from ..auth import bp as bp_auth
app = Flask(
__name__,
template_folder=TEMPLATES_ROOT,
static_folder=MEDIA_ROOT,
)
app.register_blueprint(bp_auth, url_prefix='/auth')

View File

@ -0,0 +1,7 @@
from flask import render_template
from __package__ import app
@app.route('/')
def dashboard():
return render_template('dashboard.html')

View File

@ -0,0 +1,9 @@
import os
DEBUG = True
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
MEDIA_ROOT = os.path.join(BASE_PATH, 'media')
TEMPLATES_ROOT = os.path.join(BASE_PATH, 'templates', 'admin')
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/pytestbdd-example.db'

View File

@ -0,0 +1,3 @@
from flask import Blueprint
bp = Blueprint(__name__)

View File

@ -0,0 +1,14 @@
from flaskext.sqlalchemy import SQLAlchemy
from flaskext.auth.models.sa import get_user_class
from __package__ import bp
db = SQLAlchemy(bp)
UserBase = get_user_class(db.Model)
class User(UserBase):
# Extend the user model
pass

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,10 @@
from flask import Flask
from .settings import TEMPLATES_ROOT, MEDIA_ROOT
app = Flask(
__name__,
template_folder=TEMPLATES_ROOT,
static_folder=MEDIA_ROOT,
)

View File

@ -0,0 +1,9 @@
import os
DEBUG = True
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
MEDIA_ROOT = os.path.join(BASE_PATH, 'media')
TEMPLATES_ROOT = os.path.join(BASE_PATH, 'templates', 'shop')
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/pytestbdd-example.db'

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Shop - {% block title %}Dashboard{% endblock %}</title>
<link href="/media/css/bootstrap.min.css" rel="stylesheet">
<link href="/media/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="/media/css/dashboard.css" rel="stylesheet">
<script type="text/javascript" src="/media/js/jquery-1.7.1.min.js"></script>
<script src="/media/js/bootstrap.min.js"></script>
{% block extra_head %}{% endblock %}
</head>
<body>
<div id="form" class="modal hide" role="dialog" tabindex="-1" aria-labelledby="modal-title"></div>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">Dashboard</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="/">Home</a></li>
</ul>
</div>
</div>
</div>
</div>
<ul class="breadcrumb">
<li><a href="/">Home</a> <span class="divider">/</span></li>
{% block breadcrumbs %}{% endblock %}
</ul>
<div class="container">
{% block content %}{% endblock %}
</div>
</body>
</html>

View File

@ -0,0 +1 @@
{% extends "base.html" %}

35
setup.py Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
setup(
name='pytest-bdd-example',
description='pytest-bdd example application',
author='Oleg Pidsadnyi',
author_email='oleg.podsadny@gmail.com',
version='0.1',
cmdclass={'test': PyTest},
install_requires=[
'flask-auth',
],
tests_require=[
'pytest-bdd-splinter',
],
packages=['pytest_bdd_example'],
)

0
tests/__init__.py Normal file
View File

0
tests/conftest.py Normal file
View File