|
1 | 1 | # python3-django-inventory |
2 | 2 | An inventory management system, based on buckets you can place items in |
3 | 3 |
|
4 | | -# Installation |
5 | | -This is a python 3 django module and cannot be used standalone. Also needs `crispy_forms`, which on debianoid systems is available as `python3-django-crispy-forms`. Create a project, add the contents of this repositories as a directory named `inventory`. |
| 4 | +# Install Guide |
| 5 | +**Requirements (Global Installations)** |
| 6 | + - Python3 |
| 7 | + - NGINX |
| 8 | + - python3-django |
| 9 | + - python3-django-crispy-forms |
| 10 | + - uwsgi |
| 11 | + - uwsgi-plugin-python3 |
| 12 | + |
| 13 | + **Install Steps** |
| 14 | + |
| 15 | + **Django** |
| 16 | + 1. Create a new User and login as User |
| 17 | + - `adduser inventory`* |
| 18 | + - `su - inventory`* |
| 19 | + 2. Create Django-Project |
| 20 | + - `django-admin startproject website`* |
| 21 | + - `cd website`* |
| 22 | + 3. Get python3-django-inventory |
| 23 | + - `git clone https://github.com/ChaosRambo/python3-django-inventory.git inventory` |
| 24 | + 4. Configure Django |
| 25 | + - `vim website/settings.py`* |
| 26 | + - Add to `INSTALLED_APPS`: |
| 27 | + - `'inventory',` |
| 28 | + - `'crispy_forms',` |
| 29 | + - Add to the end of the Settings: |
| 30 | + - STATIC_ROOT = os.path.join(BASE_DIR, 'static/') |
| 31 | + 5. Migrate |
| 32 | + - `./manage.py --migrate` |
| 33 | + 6. Optional Step |
| 34 | + - Test Django |
| 35 | + - `./manage.py --runserver` |
| 36 | + - You will see the Django Test site |
| 37 | + -  |
| 38 | + 7. Add URL Config |
| 39 | + - `vim website/urls.py` |
| 40 | + - Add if not exists: |
| 41 | + - `from django.conf.urls import url, include` |
| 42 | + - Add in `urlpatterns` |
| 43 | + - `url(r'^', include('inventory.urls', namespace='inventory')),` |
| 44 | + 8. Collectstatics |
| 45 | + - `./manage.py --collectstatics` |
| 46 | + 9. Optional Step |
| 47 | + - Test Django |
| 48 | + - `./manage.py runserver` |
| 49 | + - You will see an empty inventory |
| 50 | + -  |
| 51 | + 10. Add Admin |
| 52 | + - `./manage.py createsuperuser` |
| 53 | + 11. Close User |
| 54 | + - `exit` |
| 55 | + |
| 56 | +**uWSGI** |
| 57 | + |
| 58 | +1. Optional Step - Try if uWSGI correct work |
| 59 | + - `uwsgi --master --http :5000 --chdir /home/inventory/website --module website.wsgi:application` |
| 60 | + - Don't worry, if you open the site in your browser, you won't see any static stuff |
| 61 | +2. Write Systemd Service |
| 62 | + - Download the Service file with the following line: |
| 63 | + - `wget https://raw.githubusercontent.com/ChaosRambo/python3-django-inventory/master/documents/uwsgi.service -P /etc/systemd/system` |
| 64 | + - Optional: DIY |
| 65 | + - Write your own `uwsgi.service` in |
| 66 | + - `/etc/systemd/system/` |
| 67 | + - You will find more examples here: |
| 68 | + - http://uwsgi-docs.readthedocs.io/en/latest/Systemd.html |
| 69 | +3. Write uWSGI config |
| 70 | + - Create folder `sites` in: |
| 71 | + - `/etc/uwsgi` |
| 72 | + - Download inventory.ini: |
| 73 | + - `wget https://raw.githubusercontent.com/ChaosRambo/python3-django-inventory/master/documents/inventory.ini -P /etc/uwsgi/sites` |
| 74 | + - Optional: DIY |
| 75 | + - Write your own config in `sites` |
| 76 | + - You will find more examples here: |
| 77 | + - http://uwsgi-docs.readthedocs.io/en/latest/Configuration.html |
| 78 | +4. Systemd |
| 79 | + - `systemctl enable uwsgi.service` |
| 80 | + - `systemctl start uwsgi.service` |
| 81 | + |
| 82 | +**NGINX** |
| 83 | + |
| 84 | +1. Write NGINX Config |
| 85 | + - Download this config |
| 86 | + - `wget https://raw.githubusercontent.com/ChaosRambo/python3-django-inventory/master/documents/nginxconf -O inventory -P /etc/nginx/sites-available` |
| 87 | + - `ln -s /etc/nginx/sites-available/inventory /etc/nginx/sites-enabled/` |
| 88 | + - Optional: DIY |
| 89 | + - Write your Own Nginx config and create a Softlink to `sites-enabled` |
| 90 | + - Yor will find more examples here: |
| 91 | + - http://nginx.org/en/docs/ |
| 92 | + |
| 93 | + |
0 commit comments