GithubHelp home page GithubHelp logo

yeoman-flask's Introduction

Yeoman Flask Generator

Generator to use Yeoman on a Flask project.

For more informations about Yeoman, see Yeoman.io

For more informations about Flask, see Flask.pocoo.org

Installation

$ npm install -g generator-flask

Documentation

Init

$ yo flask - Generates a new Flask app with all the basic files you need.

Server

Flask needs a development server to run in order to serve the application. To do so, run $ ./server. And to make Yeoman compile your compass stylesheets, run (in a separate terminal tab) $ yeoman server. Your application will be available at 127.0.0.1:5000.

Build

If you decided to use Frozen Flask, run $ python freeze.py to build a static version of your app.

yeoman-flask's People

Contributors

cvrebert avatar halkeye avatar idbentley avatar nadirs avatar romainberger avatar sliceolife avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yeoman-flask's Issues

Fail to create a Flask project

user@notebook:~/projects/flask_project$ yo flask
/home/user/.npm-packages/lib/node_modules/generator-flask/app/index.js:17
util.inherits(Generator, yeoman.generators.NamedBase)
^

TypeError: Cannot read property 'NamedBase' of undefined
at Object. (/home/user/.npm-packages/lib/node_modules/generator-flask/app/index.js:17:43)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.defineProperty.get [as flask:app] (/home/user/.npm-packages/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:40:23)
at Store.get (/home/user/.npm-packages/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:64:35)
at Environment.get (/home/user/.npm-packages/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:262:16)
user@notebook:~/projects/flask_project$

README Documentation fix

Re. the README file, you can't actually run $ ./server or $ yeoman server. Are there perhaps some assumptions about dependencies that are not included in the README for those who have no experience with yeoman?

Error when start yo flask

thatmean@thatmean-pc:~/Dropbox/sites/yo-flask$ yo flask

TypeError: Cannot read property 'bold' of undefined
    at Object.<anonymous> (/home/thatmean/.nvm/v0.10.6/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/util/common.js:5:56)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/thatmean/.nvm/v0.10.6/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/base.js:91:26)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

I use ubuntu 12.04 lts, node 0.10.6 installed with nvm, yeoman 1.0.4, python 2.7.3, pip 1.0.

Fail to start the application

(!) require('yeoman-generator').generators.Base is deprecated. Use require('yeoman-generator').Base directly
(!) require('yeoman-generator').generators.Base is deprecated. Use require('yeoman-generator').Base directly
? Name of the app (app)

events.js:141
throw er; // Unhandled 'error' event
^

TypeError: this.env.adapter.prompt(...).then is not a function
at Generator.Base.prompt (/usr/local/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/base.js:232:45)
at Generator.askFor (/usr/local/lib/node_modules/generator-flask/app/index.js:49:8)
at Object. (/usr/local/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/base.js:431:23)
at /usr/local/lib/node_modules/generator-flask/node_modules/run-async/index.js:26:25
at /usr/local/lib/node_modules/generator-flask/node_modules/run-async/index.js:25:19
at /usr/local/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/base.js:432:9
at processImmediate as _immediateCallback

Bugs

Received a mail from someone, apparently there are some bugs so I need to look into this (there might be some issues with the latest yeoman version).

Generator not working, missing bootstrap-affix.js

Hey. Just installed Yeoman on a new machine with 'npm install -g yo' as well as 'npm install -g generator-flask'

However running this I get the following error:

kristoffer at beastmode in ~/code/cognitive.io
$ yo flask
[?] Name of the app: app
[?] Would you like to include Twitter Bootstrap for Compass instead of CSS? No
[?] Would you like to include the Twitter Bootstrap JS plugins? Yes
[?] Do you want to use Frozen-Flask to build a static version of the app? No

fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '/home/kristoffer/.cache/yeoman/twitter/bootstrap/v2.1.0/js/bootstrap-affix.js'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at Generator.copy (/home/kristoffer/.nvm/v0.10.15/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/actions/actions.js:96:13)
    at Object.copy (/home/kristoffer/.nvm/v0.10.15/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/actions/actions.js:369:12)
    at /home/kristoffer/.nvm/v0.10.15/lib/node_modules/generator-flask/app/index.js:77:16
    at Array.forEach (native)
    at /home/kristoffer/.nvm/v0.10.15/lib/node_modules/generator-flask/app/index.js:75:8
    at done (/home/kristoffer/.nvm/v0.10.15/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/actions/actions.js:391:5)
    at /home/kristoffer/.nvm/v0.10.15/lib/node_modules/generator-flask/node_modules/yeoman-generator/lib/actions/actions.js:340:16
    at Object.oncomplete (fs.js:107:15)

Fix gruntfile when app name is not called "app"


Also fix "rjs" task

(running the last commit from 'test' branch)

$ yeoman build
...
Running "rjs" task
<WARN> ENOENT, no such file or directory '/Users/<username>/tmp/yeoman-flask-test/app/index.html' Use --force to continue. </WARN>

Aborted due to warnings.

Bump `yeoman-generator`

It's at a pretty old version at the moment so let's try to update it and fix all incompatibilities.

fall install script

suenot@acer:~$ mkdir test2
suenot@acer:~$ cd test2
suenot@acer:~/test2$ sudo npm install -g yeoman-flask
npm http GET https://registry.npmjs.org/yeoman-flask
npm http 304 https://registry.npmjs.org/yeoman-flask
> [email protected] install /usr/lib/node_modules/yeoman-flask
> python install.py
It seems that Yeoman is not installed.
If you have trouble installing the generator please refer to the install instructions in the Readme.
Traceback (most recent call last):
  File "install.py", line 15, in <module>
    os.exit()
AttributeError: 'module' object has no attribute 'exit'
npm ERR! [email protected] install: `python install.py`
npm ERR! `sh "-c" "python install.py"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the yeoman-flask package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     python install.py
npm ERR! You can get their info via:
npm ERR!     npm owner ls yeoman-flask
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.5.0-19-generic
npm ERR! command "nodejs" "/usr/bin/npm" "install" "-g" "yeoman-flask"
npm ERR! cwd /home/suenot/test2
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/suenot/test2/npm-debug.log
npm ERR! not ok code 0
suenot@acer:~/test2$ 

links to stylesheets messed up in base.html

The generator generates following header (links to css files) in base.html. I guess the escape characters are not escaped and displayed as they are.

<link rel="stylesheet" href="{{ static('css/bootstrap.css') }}">
<link rel="stylesheet" href="{{ static('css/main.css') }}">

Uses outdated Grunt tasks

This configuration:


    // default lint configuration, change this to match your setup:
    // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task
    lint: {
      files: [
        'Gruntfile.js',
        'app/static/js/**/*.js',
        'spec/**/*.js'
      ]
    },

    // specifying JSHint options and globals
    // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true
      },
      globals: {
        jQuery: true
      }
    },

is as of Grunt 0.3 and doesn't work anymore

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.