Giter Site home page Giter Site logo

dulacp / accountant Goto Github PK

View Code? Open in Web Editor NEW
113.0 13.0 56.0 995 KB

Accounting made accessible for small businesses and sole proprietorships through a simple Django project.

Home Page: http://accountant-x.herokuapp.com/

License: MIT License

Makefile 1.78% Python 36.18% CSS 7.09% HTML 51.88% JavaScript 3.07%

accountant's Introduction

Accountant

In the beginning God created man, and the costs followed afterwards.

This project is a concrete integration of the django-accounting application. It is ready to be deployed on Heroku, but you can deploy on which provider you want.

Deploy

Under the hood

  • Python 3.3
  • Django 1.7+
  • dj-static
  • Already configured for an Heroku deploy

Features

Maybe you want to integrate the accounting engine into your existing project, so check out the features offered by django-accounting.

Local install

First create the virtualenv with the right python version

$ mkvirtualenv accountant --python=$(which python3)
$ workon accountant

Install the dependencies

$ pip install -r reqs/dev.txt
$ npm install

Create the local database

$ createdb accountant
$ ./manage.py migrate

Now run the server :

$ ./manage.py runserver

Deploy the beast

Prepare the static server

create a new user

$ aws iam create-user --user-name heroku-accountant

output

{
    "User": {
        "UserName": "heroku-accountant",
        "Path": "/",
        "CreateDate": "2015-01-22T14:10:08.058Z",
        "UserId": "<user_id>",
        "Arn": "arn:aws:iam::<user_arn_id>:user/heroku-accountant"
    }
}

give the user some access keys

$ aws iam create-access-key --user-name heroku-accountant

output

{
    "AccessKey": {
        "UserName": "heroku-accountant",
        "Status": "Active",
        "CreateDate": "2015-01-22T14:18:56.237Z",
        "SecretAccessKey": "<secret_key>",
        "AccessKeyId": "<access_key>"
    }
}

Write down the <secret_key> and <access_key> values, so that we can give the values to the heroku app.

create the aws bucket

$ aws s3 mb s3://accountantx --region eu-west-1

give the user access to the created bucket

$ aws iam put-user-policy --user-name heroku-accountant --policy-name AmazonS3FullAccess-heroku-accountant --policy-document '{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation",
                "s3:ListBucketMultipartUploads"
            ],
            "Resource": "arn:aws:s3:::accountantx",
            "Condition": {}
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:AbortMultipartUpload",
                "s3:DeleteObject",
                "s3:DeleteObjectVersion",
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:GetObjectVersion",
                "s3:GetObjectVersionAcl",
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:PutObjectAclVersion"
            ],
            "Resource": "arn:aws:s3:::accountantx/*",
            "Condition": {}
        }
    ]
}'

Deploy the app

We need to specify the buildpack to use otherwise heroku won't know which one to choose, due to the fact that both package.json and requirements.txt files exist.

Lancer les commandes dans l'ordre ci-dessous:

$ heroku create accountant-x --region eu
$ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git
$ heroku addons:add heroku-postgresql:hobby-dev
$ heroku addons:add mandrill:starter
$ heroku addons:add newrelic:wayne
$ heroku config:set DJANGO_SETTINGS_MODULE="accountant.settings.prod"
$ heroku config:set SECRET_KEY=`openssl rand -base64 32`
$ heroku config:set LOCAL_SERVER=0
$ heroku config:set SITE_MAIN_DOMAIN=accountant-x.herokuapp.com
$ heroku config:set DISABLE_COLLECTSTATIC=1
$ heroku config:set AWS_STORAGE_BUCKET_NAME=accountantx AWS_S3_ACCESS_KEY_ID="<access_key>" AWS_S3_SECRET_ACCESS_KEY="<secret_key>"
$ git push heroku master
$ ./manage.py collectstatic --noinput
$ aws s3 sync --acl public-read accountant/static s3://accountantx/static/
$ heroku run python manage.py migrate
$ heroku run python manage.py createsuperuser
$ heroku open

And you're done !

Cheatsheet

I've defined some shortcuts in the Makefile, feel free to explore those or add yours.

deploy to production

$ make dp

deploy & migrate to production

$ make dmp

collectstatic to production

$ make cp

Contact

Pierre Dulac
@_dulacp

License

Accounting is available under the MIT license. See the LICENSE file for more info.

accountant's People

Contributors

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

accountant's Issues

Tests in the Code?

Hi I am not able to find any tests in the python/django code. Is there any?

ImportError: cannot import name 'AutoModelSelect2Field'

Looks like the current rev is using Django-Select2 version 4 but I'm showing a Django-Select2 (5.8.10) on pip list after following install and trying initial migrate

File "/Users/bbrown/Accountant/myactenv/src/django-accounting/accounting/apps/people/forms.py", line 6, in
from django_select2 import (
ImportError: cannot import name 'AutoModelSelect2Field'

django.core.exceptions.ValidationError: ["b'{}' is not JSON serializable"]

I'm trying to install Accountant, when it' time to migrate i get this error:

(accountant) filippo@filippo-Aspire-X3900:~/Scaricati/Accountant$ ./manage.py migrate               
System check identified some issues:

WARNINGS:
books.Organization.members: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
  Synchronize unmigrated apps: bootstrap3, accounting, djrill, crispy_forms, stronghold, staticfiles, avatar, messages, libs, django_select2, datetimewidget, debug_toolbar, connect, allauth
  Apply all migrations: admin, sessions, people, reports, contenttypes, account, socialaccount, sites, auth, books
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying socialaccount.0002_auto_20150128_2227...Traceback (most recent call last):
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/allauth/socialaccount/fields.py", line 56, in get_prep_value
    return json.dumps(value)
  File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'{}' is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/migrations/executor.py", line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/migrations/migration.py", line 115, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 201, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 484, in alter_field
    old_db_params, new_db_params, strict)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/backends/postgresql_psycopg2/schema.py", line 113, in _alter_field
    new_db_params, strict,
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 566, in _alter_field
    old_default = self.effective_default(old_field)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 211, in effective_default
    default = field.get_db_prep_save(default, self.connection)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 710, in get_db_prep_save
    prepared=False)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 702, in get_db_prep_value
    value = self.get_prep_value(value)
  File "/home/filippo/Scaricati/Accountant/accountant/lib/python3.5/site-packages/allauth/socialaccount/fields.py", line 58, in get_prep_value
    raise ValidationError(str(e))
django.core.exceptions.ValidationError: ["b'{}' is not JSON serializable"]

I have tryied many versions of django-allauth with the same result.
That's the output from "pip list":

Package                Version  
---------------------- ---------
Babel                  1.3      
beautifulsoup4         4.6.0    
certifi                2018.1.18
chardet                3.0.4    
click                  6.7      
coverage               3.6      
defusedxml             0.5.0    
dj-database-url        0.3.0    
dj-static              0.0.6    
Django                 1.8.19   
django-accounting      0.2.10   
django-allauth         0.30.0   
django-appconf         1.0.2    
django-avatar          2.0      
django-bootstrap3      4.11.0   
django-bower           5.0.4    
django-classy-tags     0.5.1    
django-crispy-forms    1.4.0    
django-datetime-widget 0.9.3    
django-debug-toolbar   1.3.2    
django-dynamic-fixture 1.7.0    
django-nose            1.4.5    
Django-Select2         4.3.2    
django-stronghold      0.2.9    
django-webtest         1.7.9    
djrill                 2.1.0    
flake8                 3.5.0    
idna                   2.6      
ipdb                   0.8.3    
ipdbplugin             1.5.0    
ipython                1.1.0    
mccabe                 0.6.1    
mock                   1.0.1    
nose                   1.3.7    
npm                    0.1.1    
oauthlib               2.0.6    
optional-django        0.1.0    
ordereddict            1.1      
Pillow                 5.0.0    
pip                    9.0.1    
pkg-resources          0.0.0    
psycopg2               2.5.5    
pycodestyle            2.3.1    
pyflakes               1.6.0    
python-dateutil        2.2      
python-dotenv          0.1.5    
python3-openid         3.1.0    
pytz                   2018.3   
requests               2.18.4   
requests-oauthlib      0.8.0    
setuptools             20.7.0   
six                    1.11.0   
spec                   0.11.3   
sqlparse               0.2.4    
static3                0.7.0    
urllib3                1.22     
waitress               1.1.0    
WebOb                  1.7.4    
WebTest                2.0.12

Error deploying to heroku

ubale to deploy app to heroku following error occurs while trying to deploy
Couldn't find either the add-on service or the add-on plan of "pgbackups:auto-week

How to install and run on the local server machine?

I tried installing on the local machine to check out the accounting by running all the instructions given here, but could not make the migrations as well. So kindly any one can provide steps how to run this on local machine.
I am also ready to contribute on the issues if that is required.

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.