Thoughts on my Apistar project skeleton?


#1

Trying to build an Instrumentation (load gages etc.) inventory management system and I’m playing around with APIstar. I was hoping to get some feedback on the structure I’ve started putting together.

Or does anyone have some neat example projects they have available?


#2

I had a TypeError when running the app, had the following console output:

line 13, in edit_instrument
return Instrument.api_edit()
TypeError: api_edit() missing 2 required positional arguments: ‘session’ and ‘record_id’

EDIT:

Okay sorted those missing arguments, now its complaining about:

File “C:\Users\Username\Dropbox\python\lab_api\db\database.py”, line 71, in get_by_id
return cls.query.get(int(record_id))
AttributeError: type object ‘Instrument’ has no attribute ‘query’


#3

I like assembling a project with a structure similar to yours. I created a cookiecutter for my own work, which is primarily dependent on Postgres as the backend. So my cookiecutter wasn’t meant to really be a generic public option since it is straying into supporting only a specific stack implementation. I have never put the db content outside of my api though. What is the reasoning for this?

My app is tucked squarely away in its own package, and then tests import from that package to unit test it. The package contains a factory function and everything really get’s tied together in the wsgi_app.py which is responsible for combining config with the factory function creating a configured application.

My stuff is always a work in progress. Any feed back on my own work is appreciated too


#4

Ive got this, I dunno cookiecutter, but it works just clonning it:


#5

Another skeleton: apistar-apps. It’s django-like.


#6

Partial OT, but for Apistar using Peewee, maybe you find this useful: