Skip to main content

A simple re-usable Django application for sending and receiving messages from within django.

Project description

django_messages

A simple re-usable Django application for storing messages from within django that should support both Python 2 and 3. It only uses admin and ORM, no external-facing templates or pages.

To start, just puts them in a database. Eventually, might add ways to send them other places as well (email, message queue, etc.).

Installation

Assumptions:

  • You already have a django project, and your database is configured and tested. If you don't, see the django tutorial for instructions on creating a django project.
  • You are using a virtualenv, such that you don't have to run pip as root. If not, add sudo in front of pip commands, or open a shell as root.

Dependencies

  • install python_utilites in your django project:

      pip install python-utilities-jsm
    
  • install django_config and its requirements in your django project:

      pip install django-basic-config
    
  • install this project. Either:

    • install using pip:

        pip install django-basic-messages
      
    • or install from source:

        cd <django_project_directory>
        git clone https://github.com/jonathanmorgan/django_messages.git
        pip install -r ./django_messages/requirements.txt
      

Configuration

Update settings.py so that taggit, django_config and django_messages are in your INSTALLED_APPS. Use the new-style apps.py syntax for django_config - 'django_config.apps.Django_ConfigConfig', and django_messages - 'django_messages.apps.DjangoMessagesConfig'. The result should look like:

INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
    'taggit',
    'django_config.apps.Django_ConfigConfig',
    'django_messages.apps.DjangoMessagesConfig',
]

Database

In your django project folder, run the migrate command to create database table(s) for newly installed application(s):

python manage.py migrate

Testing

The sourcenet project has a small but growing set of unit tests that once can auto-run. These tests use django's testing framework, built on top of the Python unittest package.

Unit tests

Configuration

Database configuration

In order to run unit tests, your database configuration in settings.py will need to be connecting to the database with a user who is allowed to create databases. When django runs unit tests, it creates a test database, then deletes it once testing is done.

  • NOTE: This means the database user you use for unit testing SHOULD NOT be the user you'd use in production. The production database user should not be able to do anything outside a given database.

Running unit tests

In your django project folder, run the test command to run unit tests for this project:

python manage.py test django_messages.tests

License

Copyright 2016-present (2019) Jonathan Morgan

This file is part of https://github.com/jonathanmorgan/django_messages.

django_messages is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

django_messages is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with https://github.com/jonathanmorgan/django_messages. If not, see http://www.gnu.org/licenses/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-basic-messages-1.0.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

django_basic_messages-1.0.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file django-basic-messages-1.0.0.tar.gz.

File metadata

  • Download URL: django-basic-messages-1.0.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for django-basic-messages-1.0.0.tar.gz
Algorithm Hash digest
SHA256 de38da621019812381883e003cf078b061d8bf2197ea5ebf4651eff8fc00c120
MD5 4633276cb1b59720fcb2457712ec08ae
BLAKE2b-256 04123533af564db6058fab9616baac19155ce6f295c73ccea58276aa9374a5f3

See more details on using hashes here.

File details

Details for the file django_basic_messages-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: django_basic_messages-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for django_basic_messages-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 793cbcd1378de09970212ffae82676636c709939fb44a69718701687bb67718d
MD5 81b07c5ae53c91ed25c19dceffdac943
BLAKE2b-256 fe423fd28b52eaf4261423766e5232db3f2c12ec704da96500ebd2056007093d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page