Giter Site home page Giter Site logo

plastic-tickets's Introduction

Plastic Tickets

This is a Django project for providing and managing a 3d-printing service.

For that the django-plastic-tickets app is used.

This project additionally provides a login view, the django admin interface and a html base which renders the breadcrumbs. Additionally a bootstrap css theme is provided.

Features

Here are some features this project provides:

  • (STL) file upload and hosting
  • basic access control
    • a user can only access its associated data
    • staff can access all data
  • guided form for ticket creation
    • every option can contain a detailed markdown description
      • descriptions can be translated to all configured languages
      • they are stored in the database and can be updated as needed
    • the user can add as many models (files) to a ticket and has to specify for each file
      • a print count
      • a desired production method (FFF, SLA, ...)
      • the desired material type (PLA, PETG, ...) based on current stock
      • the desired material color
    • the user can add a custom message containing more details about the models
  • sending plain text ticket emails, while respecting mail standards such as RFC 3676
  • basic material management (filament, resin, ...)
  • german translation

Getting it up and running

Basic development setup

First make sure the following dev dependencies are installed on your system:

  • python3
  • git
  • make (optional)

Then proceed by cloning the projects repository and fetching its submodule:

git clone https://github.com/hd1ex/plastic-tickets.git
cd plastic-tickets
git submodule update --init

Now install a python venv with the projects dependencies by running

make install

You can also do this by running the commands listed in the Makefile manually.

Now you can activate the venv by running

source venv/bin/activate

To create the database and an admin user just run

python manage.py migrate
python manage.py createsuperuser

Now you probably should enable the debug mode in the Django settings (line 31).

After that, you can simply run the django dev server with

python manage.py runserver

and visit http://127.0.0.1:8000/
You should see the index view of the website.
Now a Django admin (super user) can add data and other users at http://127.0.0.1:8000/admin/

For some initial data, there is also a fixture provided at django-plastic-tickets/django_plastic_tickets/fixtures/initial_data.json. To load that data just run

python manage.py loaddata django-plastic-tickets/django_plastic_tickets/fixtures/initial_data.json

Deployment

For deployment you need the following tools:

  • git
  • docker
  • docker-compose

After you made sure they are installed, proceed by cloning the repo and its submodule:

git clone https://github.com/hd1ex/plastic-tickets.git
cd plastic-tickets
git submodule update --init

Now you want to configure your deployment by adjusting the Django settings and the server_name in the nginx config.
Additionally you maybe want to save your config changes as a patch:

mkdir patches
echo '*' > patches/.gitignore
git diff > patches/deployment_config.patch

After that you can start the website as container:

docker-compose up -d

To setup a first admin user and (optionally) add the provided initial data, start a shell in the container by running

docker exec -it shared_cash_shared-cash_1 /bin/sh

and run

python manage.py createsuperuser
python manage.py loaddata django-plastic-tickets/django_plastic_tickets/fixtures/initial_data.json # optional
exit

Now you can visit your website and login with the admin user (visit http://localhost if you left the default value).

In the long run you probably want to set up some kind of a backup system.
All interesting files live in docker volumes. To list these run

docker volume ls

Enabling https

You probably want to add a ssl certificate to enable https.
To do this with Let's Encrypt's you can open a shell in the container running nginx and generate one using certbot

docker exec -ti plastic-tickets_web_1 ash
# In the container run:
apk add certbot-nginx
certbot --nginx

Contributing

Please read Contributing.md for this.

plastic-tickets's People

Contributors

hd1ex avatar

Watchers

 avatar

Forkers

42ar

plastic-tickets's Issues

Django admin change view for PrintConfig not working

Not sure what is causing this.
I think it has to be something with the file field.

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/admin/django_plastic_tickets/printconfig/6/change/

Django Version: 3.1.2
Python Version: 3.8.6
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_bootstrap_breadcrumbs',
 'modeltranslation',
 'django_plastic_tickets']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 614, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 233, in inner
    return view(request, *args, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1656, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1534, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1567, in _changeform_view
    fieldsets = self.get_fieldsets(request, obj)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 335, in get_fieldsets
    return [(None, {'fields': self.get_fields(request, obj)})]
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 326, in get_fields
    form = self._get_form_for_get_fields(request, obj)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 666, in _get_form_for_get_fields
    return self.get_form(request, obj, fields=None)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 709, in get_form
    return modelform_factory(self.model, **defaults)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/forms/models.py", line 555, in modelform_factory
    return type(form)(class_name, (form,), form_class_attrs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/forms/models.py", line 253, in __new__
    fields = fields_for_model(
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/forms/models.py", line 179, in fields_for_model
    formfield = formfield_callback(f, **kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 185, in formfield_for_dbfield
    return db_field.formfield(**kwargs)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1661, in formfield
    return super().formfield(**{
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 929, in formfield
    return form_class(**defaults)
  File "/home/alex/projects/plastic_tickets/venv/lib/python3.8/site-packages/django/forms/fields.py", line 1122, in __init__
    for f in os.scandir(self.path):

Exception Type: FileNotFoundError at /admin/django_plastic_tickets/printconfig/6/change/
Exception Value: [Errno 2] No such file or directory: ''

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.