Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs incomplete #15

Open
berlincount opened this issue Dec 14, 2015 · 8 comments
Open

Docs incomplete #15

berlincount opened this issue Dec 14, 2015 · 8 comments

Comments

@berlincount
Copy link

Sadly, the docs are somewhat incomplete.

Can you provide a fully working, complete example.py (like https://github.com/ColtonProvias/flask-jsonapi/blob/master/example.py, or the classical ToDo example) for Flask?

I'm happy to help write some, but I'm stuck at how it is meant to work - I could fiddle something together but I'd prefer to know your intention on how it is to be used.

Thanks!

@juanitogan
Copy link

Yeah, being new to Python, I'm lost as well without a complete example. I might be able to figure it out if I could get past the first error which comes from following the very short doc:

    api = FlaskJSONAPI(app, db)
TypeError: 'NoneType' object is not callable

To those who use Flask, setting up SQLAlchemy-JSONAPI can be extremely complex and frustrating.

So true and very cruel to bait us like this. Moving back to marshmallow_jsonapi. Ugh.

@jesselang
Copy link

Hey there. Any complete examples? I am getting the same error as @juanitogan using the following requirements:

enum34==1.1.2
Flask==0.10.1
Flask-SQLAlchemy==2.1
inflection==0.3.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
psycopg2==2.6.1
SQLAlchemy==1.0.12
SQLAlchemy-JSONAPI==4.0.4
Werkzeug==0.11.4

Thanks!

@jesselang
Copy link

Looks like blinker needs to be added to the package dependencies.

>>> import sqlalchemy_jsonapi.flaskext
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/python2.7/site-packages/sqlalchemy_jsonapi/flaskext.py", line 13, in <module>
    from blinker import signal
ImportError: No module named blinker

pip install blinker gets past the initial error.

@cdpm
Copy link

cdpm commented Mar 21, 2016

Something like this worked for me:

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy_jsonapi import FlaskJSONAPI

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///my_existing_db.db'
db = SQLAlchemy(app)

class Person(db.Model):
    __tablename__ = 'person'
    id = db.Column(db.Integer, primary_key=True)
    age = db.Column(db.Integer, nullable=False)

api = FlaskJSONAPI(app, db)

if __name__ == "__main__":
    app.run()

@ColtonProvias
Copy link
Owner

I'll get an example into the docs soon! Got a little preoccupied with a project that this library is being used in.

@Datamance
Copy link

@ColtonProvias - Happy to help as well with any documentation, testing, what have you. This is a fantastic idea overall, especially for Ember developers. If only I could get it correctly configured...

@ColtonProvias
Copy link
Owner

Ember developer here as well, Datamance. We're using it on https://mynewleaf.co for most of our APIs. Of course it had to be bastardized a little bit to meet some requirements, but improvements will be flowing back into this project shortly. Pull requests and such are always appreciated!

@ColtonProvias
Copy link
Owner

@jesselang Blinker has been added. I'll update on PyPI soon.

@berlincount There is an example at sqlalchemy_jsonapi/tests/app.py. I'm still going to flesh out the docs some.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants