Skip to main content

A Django app to conduct web-based soccer polls.

Project description

The django-spoll is a Django package created to conduct web-based soccer polls. For each question, visitors can choose between a fixed number of answers, to vote for questions in 3 different categories (until now):

Note: The app within this pkg could be extended by adding categories (Django models) like Tournament, Referee, Ball, Stadium, Fan, Goal, Play, etc.

  • Player

  • Team

  • Coach

Detailed documentation is within “docs” directory of this GitLab repository. For example, you can find SQLite DB E-R UML diagram developed with Google’s SaaS tool, draw.io (redirects to https://app.diagrams.net/):

some img

Current SQLite 3 E-R diagram

Quick start

This section describes how to integrate pkg into an existent Django project.

  1. Add “django_spoll” pkg module to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...,
        'django_spoll.apps.SoccerpollConfig',
    ]
  2. Include the polls URLconf in your project urls.py like this:

    path("soccerpoll/", include("django_spoll.urls")),
  3. Run python3 manage.py migrate to create the models.

  4. Start the dev server python3 manage.py runserver 0.0.0.0:8000 & visit the admin console (http://127.0.0.1:8000/admin) to create your soccer poll.

  5. Visit the /soccerpoll/ URL to participate in the poll.

Packaging Details

The following steps were done to create & build this Python pkg & embedded module:

  1. Create a pkg folder (separated with hyphens if more than one word) to add all pkg needed content:

    mkdir django-spoll
  2. Import folder of previously developed app, i.e. soccerpoll, into this Python pkg project (add hyphens if more than one word):

    cd ~/workspaces/python/django_spoll/ | cd "C:\\..\\workspaces\\python\\django_spoll"
    mv soccerpoll/ ../pkgs/django_spoll | move soccerpoll ..\pkgs\django_spoll
    cd ../pkgs/django_spoll | cd ..\pkgs\django_spoll
    mv soccerpoll django_spoll | move soccerpoll django_spoll
  3. Edit apps.py file to validate / rename name & label variables with your preferred text editor, be aware to separate words with hyphens in name variable (refers to pkg module name) & use a simple name in label variable, which is used to give a short name for the Django app:

some img

name & label vars config. - ./django_spoll/apps.py

  1. Create docs folder to store any documentation needed, i.e. SQLite DB E-R diagram:

    mkdir docs
  2. Add LICENSE file & add the desired License content with you preferred text editor:

    touch LICENSE | edit LICENSE
  3. Add MANIFEST.in file & add the following content via CLI:

    touch MANIFEST.in | edit MANIFEST.in
    echo "recursive-include django_spoll/static *" > MANIFEST.in
    echo "recursive-include django_spoll/templates *" >> MANIFEST.in
  4. Add pyproject.toml & add the following content with your preferred text editor (be sure to adapt it to use only the needed modules, dependencies, libraries & classifiers with the right versions):

    touch pyproject.toml | edit pyproject.toml

Content:

[build-system]
requires = ["setuptools>=80.9.0"]
build-backend = "setuptools.build_meta"

[project]
name = "django-spoll"
version = "0.3.0"
dependencies = [
    "django>=6",
]
description = "A Django app to conduct web-based soccer polls."
readme = "README.rst"
license = "BSD-3-Clause"
requires-python = ">= 3.14.1"
authors = [
    {name = "Omar Abraham", email = "oym7@msn.com"},
]
classifiers = [
    "Environment :: Web Environment",
    "Framework :: Django",
    "Framework :: Django :: 6.0",
    "Intended Audience :: Developers",
    "Operating System :: OS Independent",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Topic :: Internet :: WWW/HTTP",
    "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
]

[project.urls]
Homepage = "http://127.0.0.1/soccerpoll/"
  1. Add the README.rst file that you are just reading & add the needed content or adapt it to your business needs:

    touch README.rst | edit README.rst

Once everything was correctly added / configured, let’s build the package by executing the following commands:

python3 -m pip install virtualenv | python3 -m pip install venv
source .venv/bin/activate | .venv\\Scripts\\activate
python3 -m pip install setuptools | python -m pip install setuptools
python3 -m pip install build | python -m pip install build
python3 -m build | python -m build
ll | dir

When executing the build cmd, you should see something similar to the following output:

Note: Be aware that the build is executed in the background in an isolated environment (venv + pip).

some image

Python 3 - Pkg build sample output

Notice the 2 files created during the build process, the *.tar.gz & *.whl files. That’s it, the Python pkg is ready to be imported by any other Django project.

Python pkg publishing

  1. Once the pkg was build, we need to install the following module:

    python3 -m pip install twine
  2. Now, we test first the publishing of our pkg in a “dev” environment with the following commands:

    python3 -m twine upload --repository testpypi dist/* --verbose

The pkg should be available in the following URL:

https://test.pypi.org/project/django-spoll/0.3.0/

So, to import it in any Django project we execute the following cmd:

python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps django-spoll
  1. For Pypi PROD pkgs publishing we execute the following cmd:

    python3 -m twine upload dist/* --verbose

The PROD pkg should be available in the following URL:

https://pypi.org/project/django-spoll/0.3.0/

So, to import this PROD pkg in any Django project we execute the following cmd:

python3 -m pip install --no-deps django-spoll
  1. Don’t forget to execute the freeze, to have a clear understanding of the libraries used to create this Python pkg:

    python3 -m pip freeze > requirements.txt | python -m pip freeze > requirements.txt
    more requirements.txt

Django 6 Project Reference

The Django 6 project used to build this Python 3 pkg could be found in the following GitLab repository:

  • https://gitlab.com/pythones2/django-spoll.git

Master Author: CSE. Omar Abraham - mailto:oym7@msn.com?Subject=Python3%20+%20Django%205%20Soccerpoll%20app%20setup%20+%20Tests%20+%20Deployment%20+%20Python%20Packaging%20-%20Doubt

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_spoll-0.4.0.tar.gz (96.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_spoll-0.4.0-py3-none-any.whl (95.6 kB view details)

Uploaded Python 3

File details

Details for the file django_spoll-0.4.0.tar.gz.

File metadata

  • Download URL: django_spoll-0.4.0.tar.gz
  • Upload date:
  • Size: 96.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for django_spoll-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6f9d3b9e64d2457395689678ca8c461cb26a489b0813df58b4accb39172884cd
MD5 ce32efafcb414e703fcf27cedaba902f
BLAKE2b-256 d85f0e539d9746f4fac472da0756b94a4d7b1e921ab3ff67d35d4a3bdefdbf3d

See more details on using hashes here.

File details

Details for the file django_spoll-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: django_spoll-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 95.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for django_spoll-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7200b112deeeb306290c592990638faad762afb32a209dfdb8b3b5bd6f077172
MD5 d771f04b722a6b3a23fd104228853d24
BLAKE2b-256 e671810c9ad369a2f3b01d02afb9ff3648c9d9bb67faceb72eed6c110b110237

See more details on using hashes here.

Supported by

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