GithubHelp home page GithubHelp logo

hustlzp / flask-boost Goto Github PK

View Code? Open in Web Editor NEW
508.0 26.0 71.0 2.66 MB

Flask application generator for boosting your development.

License: MIT License

Python 63.95% CSS 3.49% JavaScript 13.81% Shell 0.04% Nginx 1.49% Mako 0.70% HTML 16.52%

flask-boost's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-boost's Issues

Question:How to generate table with SQLAlchemy?

I noticed the database object file in ‘/home/yileye/project/monitor/application/models‘

And after I run the command ’boost new model‘ ,I can see the new model file in this path

But how I use this file to generate the table in mysql?

在SAE环境中,static文件夹路径似乎有问题。

本地环境中一切正常。
但在sae中,因为要引入第三方库,在sae中需要在wsgi最前面加入下面这一段
root = os.path.dirname(file)
sys.path.insert(0, os.path.join(root, 'site-packages'))
然后template中的模板里的static函数就用不了了,打开网页下方提示静态资源404

It's possible to generate sub-actions?

For example, I generate an API controller with boost new controller api then I tried to generate the action users/me with boost new action api users/me. The code generated was

@bp.route('/api/users/me')
def users/me():
    pass

clearly wrong. So, my question is, how to generate this kind of action? In case of an API I should use another approach, like generate other controllers and somehow put them together?

PS: I know that I can just change def users/me() to def users_me() but I'm asking about the right approach for this...

Compatible with Python 3.x

Some decoding and encoding code is not compatible with python 3.x

I think I will contribute some code to fix it

defautl admin user in user table

after:

  my_boost$ python manage.py db upgrade

I get user table but with no user, so no way to login:

mysql root@localhost:my_boost> select * from `user`;
+------+--------+---------+----------+------------+------------+--------------+
| id   | name   | email   | avatar   | password   | is_admin   | created_at   |
|------+--------+---------+----------+------------+------------+--------------|
+------+--------+---------+----------+------------+------------+--------------+
0 rows in set
Time: 0.003s 
mysql root@localhost:my_boost> 

Should I create it myself ?

Error using Python3 - UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdc in position 594: invalid continuation byte

I have the error below with Python3.4

rodrigo@rodrigo-xubuntu:~/projects$ boost new your_project_name
Start generating project files.
Traceback (most recent call last):
File "/usr/local/bin/boost", line 9, in
load_entry_point('Flask-Boost==0.4.4', 'console_scripts', 'boost')()
File "/usr/local/lib/python3.4/dist-packages/flask_boost/cli.py", line 80, in main
execute(args)
File "/usr/local/lib/python3.4/dist-packages/flask_boost/cli.py", line 69, in execute
_rewrite_and_copy(src_file, dst_file, project_name)
File "/usr/local/lib/python3.4/dist-packages/flask_boost/cli.py", line 102, in _rewrite_and_copy
for line in old_file:
File "/usr/lib/python3.4/codecs.py", line 313, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdc in position 594: invalid continuation byte

Does it can work?

env: windows/python2.7
error1: when install, exception throwed: tmpfile move exception. then I modify the source code, hard cord the args with "new project balabala"
error2:
from application import create_app
from application.models import db
no application found.
...

TypeError: 'encoding' is an invalid keyword

After I run the command boost new boost-test, I got this error:

Start generating project files.
New: ~/workspace/python/boost-test/
New: ~/workspace/python/boost-test/.gitignore
Traceback (most recent call last):
  File "/usr/local/bin/boost", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/flask_boost/cli.py", line 297, in main
    generate_project(args)
  File "/usr/local/lib/python2.7/site-packages/flask_boost/cli.py", line 87, in generate_project
    _rewrite_and_copy(src_file, dst_file, project_name)
  File "/usr/local/lib/python2.7/site-packages/flask_boost/cli.py", line 320, in _rewrite_and_copy
    with open(abs_path, 'w', encoding='utf-8') as new_file:
TypeError: 'encoding' is an invalid keyword argument for this function

SQLAlchemy table autoloading

Hi Zhipeng, thanks for this awesome package.

I'm used to design my own database tables, relationships and primary keys, and then use SQLAlchemy autoloading function to create table models. The database is shared among other applications, so I like to do migrations manually, without using Flask-Migration and Alembic.

This is a example model (before using Flask-Boost), accounts.py

from app import app, db
main_engine = db.get_engine(app, bind=None)

class Accounts(db.Model):
__tablename__ = 'accounts'
__table_args__ = {'autoload':True, 'autoload_with':main_engine}

Now that I'm using Flask-Boost, first I type boost new model accounts to generate the model, and then use tools like sqlacodegen to complete the model's definition. Each time I update my database schema, I need to regenerate my models.

Is there a way to use SQLAlchemy autoloading feature with Flask-Boost?

Thanks in advance.

Error using Python3 - python3 manage.py db upgrade - except ImportError, e:

(venv)rodrigo@rodrigo-xubuntu:/projects/flask_boost_site$ python3 manage.py db upgrade
Traceback (most recent call last):
File "manage.py", line 4, in
from application import create_app
File "/home/rodrigo/projects/flask_boost_site/application/init.py", line 19, in
from config import load_config
File "/home/rodrigo/projects/flask_boost_site/config/init.py", line 18
except ImportError, e:
^
SyntaxError: invalid syntax
(venv)rodrigo@rodrigo-xubuntu:
/projects/flask_boost_site$

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.