Commit 8f6ebb18 authored by Joseph Weston's avatar Joseph Weston Committed by Thomas Roos

set up packaging + webpack and rename 'server' to 'zesje'

Rename required to get the package name correct
parent af81b776
......@@ -64,7 +64,7 @@ yarn.lock
.next
# webpack output
dist/
server/static/
# IPython temporary files
.ipynb_checkpoints/
......
from setuptools import setup, find_packages
from distutils.command.build import build
from setuptools.command.sdist import sdist
def webpack():
import subprocess
subprocess.check_call(['npm', 'install'])
subprocess.check_call(['./node_modules/.bin/webpack'])
class Build(build):
def run(self):
webpack()
super().run()
class Sdist(sdist):
def run(self):
webpack()
super().run()
setup(
name="zesje",
version="0.1",
url="http://gitlab.kwant-project,org/zesje/zesje",
description="",
author="Zesje authors",
author_email="anton.akhmerov@tudelft.nl",
packages=find_packages('.'),
cmdclass={'build': Build,
'sdist': Sdist,
},
package_data={'zesje': ['static/*']},
include_package_data=True,
)
......@@ -13,7 +13,7 @@ const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
module.exports = {
entry: './client/index.js',
output: {
path: path.resolve('dist'),
path: path.resolve('zesje/static'),
filename: 'index_bundle.js'
},
module: {
......
from os import path
from os.path import abspath, dirname
from flask import Flask
from . import db, api
app = Flask('zesje', static_folder='dist')
app = Flask(__name__,
static_folder=path.join(abspath(dirname(__file__)), 'static'))
db.use_db()
app.register_blueprint(api.app, url_prefix='/api')
......
......@@ -2,5 +2,5 @@ import sys
import os
sys.path.append(os.getcwd())
from server import app
from zesje import app
app.run(debug=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment