Giter VIP home page Giter VIP logo

invoicemanager's Introduction

invoicemanager

Python (Django) invoice and customer management app

This application is still under heavy development. If you use it, please submit issues in GitHub (https://github.com/mambojuice/invoicemanager)

Project layout

Path Description
invoicemanager/ Project root (created by django-admin startproject). Home to README.md and Django's manage.py script.
invoicemanager/attachments/ FS location for attachment storage (located OUTSIDE the application root)
invoicemanager/db.sqlite3 SQLite3 database file (located OUTSIDE the application root). Created when running 'python manage.py migrate'. Will not be present if you go straight to MySQL.
invoicemanager/invoicemanager/ Application root
invoicemanager/invoicemanager/static/ Static files (CSS, JS, etc)
invoicemanager/invoicemanager/wsgi.py Python WSGI script for Apache integration

Requirements

  • pip (to install python packages)
  • django

Basic Installation

  • This guide assumes Debian/Ubuntu is the running OS. Administrative rights are obtained using sudo.
  • RPM-based systems should be similar. Windows is theoretically possible but untested.
  • The application will be installed to /opt/invoicemanager
  • Basic installation will get the application up and running, however it is not suitable for production use
  1. Install pip
$ sudo apt-get install python3 python3-pip
  1. Update pip to latest version (using sudo with pip requires the -H flag)
$ sudo -H pip install --upgrade pip
  1. Install Django
$ pip install django
  1. Download InvoiceManager from Github repo. Optionally, download the Zip file from https://github.com/mambojuice/invoicemanager/archive/master.zip
$ git clone https://github.com/mambojuice/invoicemanager --branch master
$ sudo cp -r invoicemanager /opt
$ cd /opt/invoicemanager
  1. Edit the following lines of invoicemanager/settings.py to match your environment
#  Put a random string at least 50 characters long here. This will keep hashed passwords safe.
SECRET_KEY = 'abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()<>{}'

# Set to match system time
TIME_ZONE = 'UTC'
  1. Create the application database
/opt/invoicemanager$ sudo python3 manage.py migrate
  1. Create an admin user
/opt/invoicemanager$ sudo python3 manage.py createsuperuser
Username (leave blank to use 'root'): admin
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
  1. At this point, you should have enough configured to run the app using Python's development server. Run the following command and browse to http://localhost:8000
/opt/invoicemanager$ sudo python3 manage.py runserver 0.0.0.0:8000

Using MySQL instead of SQLite3

  1. Install MySQL client and Python MySQL driver
$ sudo apt-get install mariadb-client
$ sudo -H pip install mysqlclient
  1. Create the MySQL database and user
$ mysql -u root -p [-h servername]
create database 'invoicemanager';
grant all on 'invoicemanager'.* to 'invoicemanager'@'%' identified by 'mysecretpassword';
exit;
  1. Update invoicemanager/settings.py. Find the 'DATABASES' section, comment the sqlite database settings and uncomment the mysql settings.
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

# Use settings below for local sqlite file

# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.sqlite3',
#         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#                 'USER': '',
#         'PASSWORD': '',
#         'HOST': '',
#         'PORT': '',
#     }
# }

# Use settings below for MySQL server (requires python-mysql)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'invoicemanager',
        'USER': 'invoicemanager',
        'PASSWORD': 'mysecretpassword',
        'HOST': 'servername',
        'PORT': '',
    }
}

Using a production web server

It is highly recommended to use a 'real' web server for running invoicemanager. This example uses apache, however any wsgi-compatible server will work.

  1. Install apache and wsgi module
$ sudo apt-get install apache2 libapache2-mod-wsgi-py3
$ sudo a2enmod wsgi
  1. Edit apache config to use wsgi.py included with invoicemanager and include static and attachments directories
$ sudo nano /etc/apache2/sites-enabled/000-default.conf
# These lines must be outside of the VirtualHost directive
WSGIScriptAlias / /opt/invoicemanager/invoicemanager/wsgi.py
WSGIPythonPath /opt/invoicemanager

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /opt/invoicemanager>
                Options Indexes MultiViews FollowSymLinks
                Require all granted
        </Directory>

        <Directory /opt/invoicemanager/invoicemanager>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

		# The real location of these directories can be moved if desired.
        # Remember to update /opt/invoicemanager/invoicemanager/settings.py to reflect changes here.
        Alias /static /opt/invoicemanager/invoicemanager/static
        Alias /attachments /opt/invoicemanager/attachments
</VirtualHost>
  1. Restart apache and you should be in business!
$ sudo service apache2 restart

invoicemanager's People

Contributors

mambojuice avatar

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.