Coder Social home page Coder Social logo

Comments (6)

miguelgrinberg avatar miguelgrinberg commented on May 21, 2024

Please point me to an example that I can use to reproduce this.

from flask-socketio.

Perlence avatar Perlence commented on May 21, 2024

With pleasure.

# test.py

from gevent import monkey
monkey.patch_all()

from functools import partial
from os import path

from flask import Flask
from flask.ext.assets import Environment, Bundle
from flask.ext.socketio import SocketIO

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)

env = Environment(app)

env.load_path = [
    path.join(path.dirname(__file__), 'bower_components'),
]

js_bundle = Bundle(
    'jquery/dist/jquery.min.js',
    'bootstrap-sass/dist/js/bootstrap.min.js',
    output='js_all.js')

css_bundle = Bundle(
    'bootstrap-sass/lib/bootstrap.scss',
    filters=['pyscss'],
    output='css_all.css')

env.register('js_all', js_bundle)
env.register('css_all', css_bundle)

env['js_all'].urls()
env['css_all'].urls()
print 'Testing'


@app.route('/')
def index():
    return 'Success'


def start(debug=False):
    app.debug = debug
    socketio.run(app, host='127.0.0.1', port=5000)

debug = partial(start, debug=True)

if __name__ == '__main__':
    debug()

I find it strange, that when I start the program, it prints 'Testing' twice:

$ python test.py
C:\Python27\lib\site-packages\scss\__init__.py:86: RuntimeWarning: Scanning acceleration disabled (_speedups not found)!
  RuntimeWarning
Testing
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader
Testing

Flask doesn't respond:

$ curl http://127.0.0.1:5000
curl: (56) Recv failure: Connection was reset

Things I've tried:

  • disable monkey patching, also tried monkey.patch_all(select=False, thread=False)
  • comment out env['css_all'].urls() in case the issue has something to do with pyScss
  • disable debugging

from flask-socketio.

miguelgrinberg avatar miguelgrinberg commented on May 21, 2024

Do you have the complete project somewhere, including the asset files?

I find it strange, that when I start the program, it prints 'Testing' twice:

This is normal in debug mode, as Flask starts two processes, one master process and then one child process that will be restarted when a source file changes.

from flask-socketio.

Perlence avatar Perlence commented on May 21, 2024

Here's project with assets. https://github.com/Perlence/flask-socketio-assets

from flask-socketio.

miguelgrinberg avatar miguelgrinberg commented on May 21, 2024

Your project runs perfectly fine for me, both in debug and non-debug modes.

from flask-socketio.

Perlence avatar Perlence commented on May 21, 2024

Closing this since I no longer use Flask-Assets. Thank you for feedback.

from flask-socketio.

Related Issues (20)

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.