diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 7437cc8..0000000 --- a/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ - Copyright (c) [2018-2020] - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Login/__init__.py b/Login/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Login/__pycache__/__init__.cpython-36.pyc b/Login/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..f12bd0c Binary files /dev/null and b/Login/__pycache__/__init__.cpython-36.pyc differ diff --git a/Login/__pycache__/__init__.cpython-38.pyc b/Login/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..cf68e12 Binary files /dev/null and b/Login/__pycache__/__init__.cpython-38.pyc differ diff --git a/Login/__pycache__/settings.cpython-36.pyc b/Login/__pycache__/settings.cpython-36.pyc new file mode 100644 index 0000000..d35fbdf Binary files /dev/null and b/Login/__pycache__/settings.cpython-36.pyc differ diff --git a/Login/__pycache__/settings.cpython-38.pyc b/Login/__pycache__/settings.cpython-38.pyc new file mode 100644 index 0000000..b14092f Binary files /dev/null and b/Login/__pycache__/settings.cpython-38.pyc differ diff --git a/Login/__pycache__/urls.cpython-38.pyc b/Login/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..df167dc Binary files /dev/null and b/Login/__pycache__/urls.cpython-38.pyc differ diff --git a/Login/__pycache__/wsgi.cpython-38.pyc b/Login/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000..100e4af Binary files /dev/null and b/Login/__pycache__/wsgi.cpython-38.pyc differ diff --git a/Login/asgi.py b/Login/asgi.py new file mode 100644 index 0000000..3ff2fb7 --- /dev/null +++ b/Login/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for Login project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Login.settings') + +application = get_asgi_application() diff --git a/Login/settings.py b/Login/settings.py new file mode 100644 index 0000000..cee56f8 --- /dev/null +++ b/Login/settings.py @@ -0,0 +1,123 @@ + +import os +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '&z9yaki6^*-kmxxw)q@%&5s8(b=&=e04%-pb7vs8ne&bwh9#m0' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.sites', + 'django.contrib.admin', + 'registration', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'bootstrap4', + 'Login', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'Login.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'Login.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'djangologin', + 'USER': 'karis', + 'PASSWORD': 'K@r!s##!', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'Africa/Nairobi' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.1/howto/static-files/ + +STATIC_URL = '/static/' + + + +ACCOUNT_ACTIVATION_DAYS = 7 # One-Week Activation Expiry +REGISTRATION_AUTO_LOGIN = True # Automatically Log the User In. +SITE_ID = 1 +LOGIN_REDIRECT_URL = '/' \ No newline at end of file diff --git a/Login/urls.py b/Login/urls.py new file mode 100644 index 0000000..cdeec9b --- /dev/null +++ b/Login/urls.py @@ -0,0 +1,14 @@ +"""Login URL Configuration""" + +# Imports Views For Success to Render Content. +from Success import views +from django.urls import include + +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path('admin/', admin.site.urls), + # Includes Success url patterns + path('', include('Success.urls')), +] diff --git a/Login/wsgi.py b/Login/wsgi.py new file mode 100644 index 0000000..6922179 --- /dev/null +++ b/Login/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for Login project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Login.settings') + +application = get_wsgi_application() diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..f5c3286 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn Login.wsgi diff --git a/README.md b/README.md index d46469d..3f88483 100644 --- a/README.md +++ b/README.md @@ -1,151 +1,27 @@ -# DESCRIPTION +# Login -This is a **shell script** that that allows **execution of Django** a python based framework. +# Description -A shell script is a **computer program** designed to be run by the Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts ***include file manipulation, program execution, and printing text.*** A script which sets up the environment, runs the program, and does any necessary cleanup, logging, etc. is called a wrapper. - -Django is a **high-level Python Web framework** that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. - -# **WHAT THIS DJANGO-SHELL-SCRIPT DOES FOR YOU.** - -**{Please go through what this shell-script does for you. It will help you avoid bugs in your code. In case you use a technology that might cause failure of your code to run}** - -1. Creates a **folder** for you. - -2. Initializes Empty **Git Repository**. - -3. Installs **Django 2.0.7** (Can be updated to latest version). - -4. Installs **Django-bootstrap4.** - -5. Installs **pillow** for Image Integration. - -6. Installs **dj-database-url.** - -7. Installs **gunicorn.** - -8. Installs **psycopg2.** - -9. Installs **whitenoise.** - -10. Installs **python-decouple.** - -11. Installs **wheel** - - -**CREATED FILES** -The script also **helps in creating some files** and this making it easy for you to code as you no longer hav to create them on your own. - -It simply creates files and adds the preset standard code thats will not change in any given file structure. - - -1. Creates **static** file together with **css files.** - -2. Creates **templates** - -3. Creates **base.html** and **adds it to** the templates folder. - -4. Creates **index.html**, **links it to base.html using {% extends ' '%}** then **adds it to** templates folder. - -5. Creates **virtual environment**. - -6. Creates **.env** file and **sets DEBUG = True** - -7. Creates **.gitignore** and adds **(virtual/ | *.pyc | .env | migrations/ )** to .gitignore. - -8. Creates **Procfile** - -9. Creates **README.md** - -10. Creates **requirements.txt** - -* You are now ready to code. - - - -# Prerequisites. - -* You need to have nano text editor installed. you can find out whether you have it installed by typing nano --version in your terminal. For most linux distributions, it is installed by default. - -* To work with the script you have to clone Django-shell-script on my github repo. - -Link:-> ```https://github.com/zecollokaris/Django-shell-script``` - -**Installing Nano Text Editor.** - --However, if you don't have it installed, you can quicky do that by typing: - - -``` - sudo apt-get install nano -``` - -* You need to have (python3.6) installed in your machine. - --To check if you already have python3.6 before installing type: - - - -``` -python3.6 -V -``` - -**Installing Python3.6** - -To install python3.6 you can quicky do that by typing: - - - -``` -sudo apt-get install python3.6 -``` +# Prerequisites # Setup/Installation Reqiurements. - **{follow the below instructions for set up.}** -1. You will need **Internet connection.** - -2. You will also need a Webpage URL to load in URL's: - -3. To **get to use Django-shell-script** fist you need to get to the **Django-shell-script repository.** - -Link:-> ```https://github.com/zecollokaris/Django-shell-script``` - -4. From there you can access Django-shell-script. - -5. **Clone** the project. - -6. **Once you done with cloning** and project is on your device. +# Technologies Used -7. **get into project folder** (cd into project). +# Support and Contact +-Mobile number: (+254) 798731203 +-Email Address: collo.kariss@gmail.com -# **HOW TO USE.** - -**To work With this Django-shell-script** - -1. **Make sure your inside folder containing script.** - -2. Create **Django folder structure** - - ``` - source newDjango.sh (PROJECTNAME) (APPNAME) - ``` - -3. From there the it will **prompt you to create a PostgreSQL Database** an object-relational database management system. - -4. You Django is ready **HAPPY CODING :-)** - ---- +-github-username: zecollokaris ## License The app is licensed by MIT. -MIT (c) 2018 - 2020 +Collins Kariuki - MIT (c)2018 LICENSE + -Feel FREE to contribute to make the **script** better for others. ---- diff --git a/Success/__init__.py b/Success/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Success/__pycache__/__init__.cpython-38.pyc b/Success/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..09e3185 Binary files /dev/null and b/Success/__pycache__/__init__.cpython-38.pyc differ diff --git a/Success/__pycache__/urls.cpython-38.pyc b/Success/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..8e4a24b Binary files /dev/null and b/Success/__pycache__/urls.cpython-38.pyc differ diff --git a/Success/__pycache__/views.cpython-38.pyc b/Success/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..ce94f63 Binary files /dev/null and b/Success/__pycache__/views.cpython-38.pyc differ diff --git a/Success/admin.py b/Success/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/Success/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/Success/apps.py b/Success/apps.py new file mode 100644 index 0000000..b3dd825 --- /dev/null +++ b/Success/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class SuccessConfig(AppConfig): + name = 'Success' diff --git a/Success/migrations/__init__.py b/Success/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Success/models.py b/Success/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/Success/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/Success/templates/Success/base.html b/Success/templates/Success/base.html new file mode 100644 index 0000000..54e1c3e --- /dev/null +++ b/Success/templates/Success/base.html @@ -0,0 +1,22 @@ +{%load bootstrap4 %} +{% load static %} + + + + Login +{%block styles%} +{%bootstrap_css%} + +{% endblock %} + + + +{%block content%} +{% endblock %} +{% block scripts %} + + + {% bootstrap_javascript %} {% endblock %} + + + diff --git a/Success/templates/Success/index.html b/Success/templates/Success/index.html new file mode 100644 index 0000000..f01cffd --- /dev/null +++ b/Success/templates/Success/index.html @@ -0,0 +1,2 @@ +{%extends 'Success/base.html'%} +{%block content%} diff --git a/Success/templates/registration/activate.html b/Success/templates/registration/activate.html new file mode 100755 index 0000000..3a7a136 --- /dev/null +++ b/Success/templates/registration/activate.html @@ -0,0 +1,18 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Activation Failure" %}{% endblock %} + +{% block content %} +

{% trans "Account activation failed." %}

+{% endblock %} + + +{% comment %} +**registration/activate.html** + +Used if account activation fails. With the default setup, has the following context: + +``activation_key`` + The activation key used during the activation attempt. +{% endcomment %} diff --git a/Success/templates/registration/activation_complete.html b/Success/templates/registration/activation_complete.html new file mode 100755 index 0000000..b66e0d6 --- /dev/null +++ b/Success/templates/registration/activation_complete.html @@ -0,0 +1,22 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Account Activated" %}{% endblock %} + +{% block content %} +

+ {% trans "Your account is now activated." %} + {% if not user.is_authenticated %} + {% trans "You can log in." %} + {% endif %} +

+{% endblock %} + + +{% comment %} +**registration/activation_complete.html** + +Used after successful account activation. This template has no context +variables of its own, and should simply inform the user that their +account is now active. +{% endcomment %} diff --git a/Success/templates/registration/activation_complete_admin_pending.html b/Success/templates/registration/activation_complete_admin_pending.html new file mode 100644 index 0000000..25357ca --- /dev/null +++ b/Success/templates/registration/activation_complete_admin_pending.html @@ -0,0 +1,22 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Account Activated" %}{% endblock %} + +{% block content %} +

+ {% trans "Your account is now activated." %} + {% if not user.is_authenticated %} + {% trans "Once a site administrator activates your account you can login." %} + {% endif %} +

+{% endblock %} + + +{% comment %} +**registration/activation_complete.html** + +Used after successful account activation. This template has no context +variables of its own, and should simply inform the user that their +account is now active. +{% endcomment %} diff --git a/Success/templates/registration/activation_email.html b/Success/templates/registration/activation_email.html new file mode 100644 index 0000000..cee8f9d --- /dev/null +++ b/Success/templates/registration/activation_email.html @@ -0,0 +1,72 @@ +{% load i18n %} + + + + + {{ site.name }} {% trans "registration" %} + + + +

+ {% blocktrans with site_name=site.name %} + You (or someone pretending to be you) have asked to register an account at + {{ site_name }}. If this wasn't you, please ignore this email + and your address will be removed from our records. + {% endblocktrans %} +

+

+ {% blocktrans %} + To activate this account, please click the following link within the next + {{ expiration_days }} days: + {% endblocktrans %} +

+ +

+ + {{site.domain}}{% url 'registration_activate' activation_key %} + +

+

+ {% blocktrans with site_name=site.name %} + Sincerely, + {{ site_name }} Management + {% endblocktrans %} +

+ + + + + +{% comment %} +**registration/activation_email.html** + +Used to generate the html body of the activation email. Should display a +link the user can click to activate the account. This template has the +following context: + +``activation_key`` + The activation key for the new account. + +``expiration_days`` + The number of days remaining during which the account may be + activated. + +``site`` + An object representing the site on which the user registered; + depending on whether ``django.contrib.sites`` is installed, this + may be an instance of either ``django.contrib.sites.models.Site`` + (if the sites application is installed) or + ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the + documentation for the Django sites framework + `_ for + details regarding these objects' interfaces. + +``user`` + The new user account + +``request`` + ``HttpRequest`` instance for better flexibility. + For example it can be used to compute absolute register URL: + + {{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %} +{% endcomment %} diff --git a/Success/templates/registration/activation_email.txt b/Success/templates/registration/activation_email.txt new file mode 100644 index 0000000..303d7ed --- /dev/null +++ b/Success/templates/registration/activation_email.txt @@ -0,0 +1,52 @@ +{% load i18n %} +{% blocktrans with site_name=site.name %} +You (or someone pretending to be you) have asked to register an account at +{{ site_name }}. If this wasn't you, please ignore this email +and your address will be removed from our records. +{% endblocktrans %} +{% blocktrans %} +To activate this account, please click the following link within the next +{{ expiration_days }} days: +{% endblocktrans %} + +http://{{site.domain}}{% url 'registration_activate' activation_key %} + +{% blocktrans with site_name=site.name %} +Sincerely, +{{ site_name }} Management +{% endblocktrans %} + + +{% comment %} +**registration/activation_email.txt** + +Used to generate the text body of the activation email. Should display a +link the user can click to activate the account. This template has the +following context: + +``activation_key`` + The activation key for the new account. + +``expiration_days`` + The number of days remaining during which the account may be + activated. + +``site`` + An object representing the site on which the user registered; + depending on whether ``django.contrib.sites`` is installed, this + may be an instance of either ``django.contrib.sites.models.Site`` + (if the sites application is installed) or + ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the + documentation for the Django sites framework + `_ for + details regarding these objects' interfaces. + +``user`` + The new user account + +``request`` + ``HttpRequest`` instance for better flexibility. + For example it can be used to compute absolute register URL: + + {{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %} +{% endcomment %} diff --git a/Success/templates/registration/activation_email_subject.txt b/Success/templates/registration/activation_email_subject.txt new file mode 100644 index 0000000..da0ddeb --- /dev/null +++ b/Success/templates/registration/activation_email_subject.txt @@ -0,0 +1,28 @@ +{% load i18n %}{% trans "Account activation on" %} {{ site.name }} + + +{% comment %} +**registration/activation_email_subject.txt** + +Used to generate the subject line of the activation email. Because the +subject line of an email must be a single line of text, any output +from this template will be forcibly condensed to a single line before +being used. This template has the following context: + +``activation_key`` + The activation key for the new account. + +``expiration_days`` + The number of days remaining during which the account may be + activated. + +``site`` + An object representing the site on which the user registered; + depending on whether ``django.contrib.sites`` is installed, this + may be an instance of either ``django.contrib.sites.models.Site`` + (if the sites application is installed) or + ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the + documentation for the Django sites framework + `_ for + details regarding these objects' interfaces. +{% endcomment %} diff --git a/Success/templates/registration/admin_approve.html b/Success/templates/registration/admin_approve.html new file mode 100644 index 0000000..487c1fb --- /dev/null +++ b/Success/templates/registration/admin_approve.html @@ -0,0 +1,18 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Approval Failure" %}{% endblock %} + +{% block content %} +

{% trans "Account Approval failed." %}

+{% endblock %} + + +{% comment %} +**registration/admin_approve.html** + +Used if account activation fails. With the default setup, has the following context: + +``activation_key`` + The activation key used during the activation attempt. +{% endcomment %} diff --git a/Success/templates/registration/admin_approve_complete.html b/Success/templates/registration/admin_approve_complete.html new file mode 100644 index 0000000..f4ad870 --- /dev/null +++ b/Success/templates/registration/admin_approve_complete.html @@ -0,0 +1,33 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Account Approved" %}{% endblock %} + +{% block content %} +

+ {% trans "The user's account is now approved." %} +

+{% endblock %} + + +{% comment %} +**registration/admin_approve_complete.html** + +Used to generate the html body of the admin activation email. Should display a +link for an admin to approve activation of the account. This template has the +following context: + +``site`` + An object representing the site on which the user registered; + depending on whether ``django.contrib.sites`` is installed, this + may be an instance of either ``django.contrib.sites.models.Site`` + (if the sites application is installed) or + ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the + documentation for the Django sites framework + `_ for + details regarding these objects' interfaces. + +``user`` + The new user account + +{% endcomment %} diff --git a/Success/templates/registration/admin_approve_complete_email.html b/Success/templates/registration/admin_approve_complete_email.html new file mode 100644 index 0000000..55368af --- /dev/null +++ b/Success/templates/registration/admin_approve_complete_email.html @@ -0,0 +1,27 @@ +{% load i18n %} + + + + + {{ site.name }} {% trans "admin approval" %} + + + +

+ {% blocktrans %} + Your account is now approved. You can + {% endblocktrans %} + {% trans "log in." %} +

+ + + + + +{% comment %} +**registration/admin_approve_complete_email.html** + +Used after successful account activation. This template has no context +variables of its own, and should simply inform the user that their +account is now active. +{% endcomment %} diff --git a/Success/templates/registration/admin_approve_complete_email.txt b/Success/templates/registration/admin_approve_complete_email.txt new file mode 100644 index 0000000..f0fada3 --- /dev/null +++ b/Success/templates/registration/admin_approve_complete_email.txt @@ -0,0 +1,13 @@ +{% load i18n %} +{% blocktrans %} +Your account is now approved. You can log in using the following link +{% endblocktrans %} +http://{{site.domain}}{% url 'auth_login' %} + +{% comment %} +**registration/admin_approve_complete_email.txt** + +Used after successful account activation. This template has no context +variables of its own, and should simply inform the user that their +account is now active. +{% endcomment %} diff --git a/Success/templates/registration/admin_approve_complete_email_subject.txt b/Success/templates/registration/admin_approve_complete_email_subject.txt new file mode 100644 index 0000000..6dac1db --- /dev/null +++ b/Success/templates/registration/admin_approve_complete_email_subject.txt @@ -0,0 +1,21 @@ +{% load i18n %}{% trans "Account activation on" %} {{ site.name }} + + +{% comment %} +**registration/admin_approve_complete_email_subject.txt** + +Used to generate the subject line of the admin approval complete email. Because +the subject line of an email must be a single line of text, any output +from this template will be forcibly condensed to a single line before +being used. This template has the following context: + +``site`` + An object representing the site on which the user registered; + depending on whether ``django.contrib.sites`` is installed, this + may be an instance of either ``django.contrib.sites.models.Site`` + (if the sites application is installed) or + ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the + documentation for the Django sites framework + `_ for + details regarding these objects' interfaces. +{% endcomment %} diff --git a/Success/templates/registration/admin_approve_email.html b/Success/templates/registration/admin_approve_email.html new file mode 100644 index 0000000..5a4e36b --- /dev/null +++ b/Success/templates/registration/admin_approve_email.html @@ -0,0 +1,60 @@ +{% load i18n %} + + + + + {{ site.name }} {% trans "registration" %} + + + +

+ {% blocktrans with site_name=site.name %} + The following user ({{ user }}) has asked to register an account at + {{ site_name }}. + {% endblocktrans %} +

+

+ {% blocktrans %} + To approve this, please + {% endblocktrans %} + {% trans "click here" %}. +

+

+ {% blocktrans with site_name=site.name %} + Sincerely, + {{ site_name }} Management + {% endblocktrans %} +

+ + + + +{% comment %} +**registration/admin_approve_email.html** + +Used to generate the html body of the admin activation email. Should display a +link for an admin to approve activation of the account. This template has the +following context: + +``profile_id`` + The id of the registration profile requesting approval + +``site`` + An object representing the site on which the user registered; + depending on whether ``django.contrib.sites`` is installed, this + may be an instance of either ``django.contrib.sites.models.Site`` + (if the sites application is installed) or + ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the + documentation for the Django sites framework + `_ for + details regarding these objects' interfaces. + +``user`` + The new user account + +``request`` + ``HttpRequest`` instance for better flexibility. + For example it can be used to compute absolute approval URL: + + {{ request.scheme }}://{{ request.get_host }}{% url 'registration_admin_approve' profile_id %} +{% endcomment %} diff --git a/Success/templates/registration/admin_approve_email.txt b/Success/templates/registration/admin_approve_email.txt new file mode 100644 index 0000000..19ac274 --- /dev/null +++ b/Success/templates/registration/admin_approve_email.txt @@ -0,0 +1,10 @@ +{% load i18n %} +{% blocktrans with site_name=site.name %} +The following user ({{ user }}) has asked to register an account at +{{ site_name }}. +{% endblocktrans %} +{% blocktrans %} +To approve this, please click the following link. +{% endblocktrans %} + +http://{{site.domain}}{% url 'registration_admin_approve' profile_id %} diff --git a/Success/templates/registration/admin_approve_email_subject.txt b/Success/templates/registration/admin_approve_email_subject.txt new file mode 100644 index 0000000..3cd2bd9 --- /dev/null +++ b/Success/templates/registration/admin_approve_email_subject.txt @@ -0,0 +1 @@ +{% load i18n %}{% trans "Account approval on" %} {{ site.name }} diff --git a/Success/templates/registration/login.html b/Success/templates/registration/login.html new file mode 100755 index 0000000..2e029ba --- /dev/null +++ b/Success/templates/registration/login.html @@ -0,0 +1,45 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Log in" %}{% endblock %} + +{% block content %} +
+ {% csrf_token %} + {{ form.as_p }} + + +
+ +

{% trans "Forgot your password?" %} {% trans "Reset it" %}.

+

{% trans "Not a member?" %} {% trans "Register" %}.

+{% endblock %} + + +{% comment %} +**registration/login.html** + +It's your responsibility to provide the login form in a template called +registration/login.html by default. This template gets passed four +template context variables: + +``form`` + A Form object representing the login form. See the forms + documentation for more on Form objects. + +``next`` + The URL to redirect to after successful login. This may contain a + query string, too. + +``site`` + The current Site, according to the SITE_ID setting. If you don't + have the site framework installed, this will be set to an instance + of RequestSite, which derives the site name and domain from the + current HttpRequest. + +``site_name`` + An alias for site.name. If you don't have the site framework + installed, this will be set to the value of + request.META['SERVER_NAME']. For more on sites, see The + "sites" framework. +{% endcomment %} diff --git a/Success/templates/registration/logout.html b/Success/templates/registration/logout.html new file mode 100755 index 0000000..e93d840 --- /dev/null +++ b/Success/templates/registration/logout.html @@ -0,0 +1,8 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Logged out" %}{% endblock %} + +{% block content %} +

{% trans "Successfully logged out" %}.

+{% endblock %} diff --git a/Success/templates/registration/password_change_done.html b/Success/templates/registration/password_change_done.html new file mode 100755 index 0000000..f886aa4 --- /dev/null +++ b/Success/templates/registration/password_change_done.html @@ -0,0 +1,11 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Password changed" %}{% endblock %} + +{% block content %} +

{% trans "Password successfully changed!" %}

+{% endblock %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/password_change_form.html b/Success/templates/registration/password_change_form.html new file mode 100755 index 0000000..6be761f --- /dev/null +++ b/Success/templates/registration/password_change_form.html @@ -0,0 +1,15 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Change password" %}{% endblock %} + +{% block content %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/password_reset_complete.html b/Success/templates/registration/password_reset_complete.html new file mode 100755 index 0000000..00b755a --- /dev/null +++ b/Success/templates/registration/password_reset_complete.html @@ -0,0 +1,15 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Password reset complete" %}{% endblock %} + +{% block content %} +

+ {% trans "Your password has been reset!" %} + {% blocktrans %}You may now log in{% endblocktrans %}. + +

+{% endblock %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/password_reset_confirm.html b/Success/templates/registration/password_reset_confirm.html new file mode 100755 index 0000000..aeafc50 --- /dev/null +++ b/Success/templates/registration/password_reset_confirm.html @@ -0,0 +1,26 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block meta %} + + +{% endblock %} + +{% block title %}{% trans "Confirm password reset" %}{% endblock %} + +{% block content %} +{% if validlink %} +

{% trans "Enter your new password below to reset your password:" %}

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% else %} + Password reset unsuccessful. Please try again. +{% endif %} +{% endblock %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/password_reset_done.html b/Success/templates/registration/password_reset_done.html new file mode 100755 index 0000000..8624a51 --- /dev/null +++ b/Success/templates/registration/password_reset_done.html @@ -0,0 +1,16 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Password reset" %}{% endblock %} + +{% block content %} +

+ {% blocktrans %} + We have sent you an email with a link to reset your password. Please check + your email and click the link to continue. + {% endblocktrans %} +

+{% endblock %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/password_reset_email.html b/Success/templates/registration/password_reset_email.html new file mode 100755 index 0000000..8653551 --- /dev/null +++ b/Success/templates/registration/password_reset_email.html @@ -0,0 +1,27 @@ +{% load i18n %} + +{% blocktrans %}Greetings{% endblocktrans %} {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %}, + +{% blocktrans %} +You are receiving this email because you (or someone pretending to be you) +requested that your password be reset on the {{ domain }} site. If you do not +wish to reset your password, please ignore this message. +{% endblocktrans %} + +{% blocktrans %} +To reset your password, please click the following link, or copy and paste it +into your web browser: +{% endblocktrans %} + + + {{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %} + + +{% blocktrans %}Your username, in case you've forgotten:{% endblocktrans %} {{ user.get_username }} + + +{% blocktrans %}Best regards{% endblocktrans %}, +{{ site_name }} {% blocktrans %}Management{% endblocktrans %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/password_reset_form.html b/Success/templates/registration/password_reset_form.html new file mode 100755 index 0000000..27ed5c4 --- /dev/null +++ b/Success/templates/registration/password_reset_form.html @@ -0,0 +1,20 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Reset password" %}{% endblock %} + +{% block content %} +

+ {% blocktrans %} + Forgot your password? Enter your email in the form below and we'll send you instructions for creating a new one. + {% endblocktrans %} +

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} + + +{# This is used by django.contrib.auth #} diff --git a/Success/templates/registration/registration_base.html b/Success/templates/registration/registration_base.html new file mode 100755 index 0000000..94d9808 --- /dev/null +++ b/Success/templates/registration/registration_base.html @@ -0,0 +1 @@ +{% extends "base.html" %} diff --git a/Success/templates/registration/registration_closed.html b/Success/templates/registration/registration_closed.html new file mode 100755 index 0000000..94daff1 --- /dev/null +++ b/Success/templates/registration/registration_closed.html @@ -0,0 +1,8 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Registration is closed" %}{% endblock %} + +{% block content %} +

{% trans "Sorry, but registration is closed at this moment. Come back later." %}

+{% endblock %} diff --git a/Success/templates/registration/registration_complete.html b/Success/templates/registration/registration_complete.html new file mode 100755 index 0000000..f0d0596 --- /dev/null +++ b/Success/templates/registration/registration_complete.html @@ -0,0 +1,18 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Activation email sent" %}{% endblock %} + +{% block content %} +

{% trans "Please check your email to complete the registration process." %}

+{% endblock %} + + +{% comment %} +**registration/registration_complete.html** + +Used after successful completion of the registration form. This +template has no context variables of its own, and should simply inform +the user that an email containing account-activation information has +been sent. +{% endcomment %} diff --git a/Success/templates/registration/registration_form.html b/Success/templates/registration/registration_form.html new file mode 100755 index 0000000..42b4051 --- /dev/null +++ b/Success/templates/registration/registration_form.html @@ -0,0 +1,25 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Register for an account" %}{% endblock %} + +{% block content %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} + + +{% comment %} +**registration/registration_form.html** +Used to show the form users will fill out to register. By default, has +the following context: + +``form`` + The registration form. This will be an instance of some subclass + of ``django.forms.Form``; consult `Django's forms documentation + `_ for + information on how to display this in a template. +{% endcomment %} diff --git a/Success/templates/registration/resend_activation_complete.html b/Success/templates/registration/resend_activation_complete.html new file mode 100644 index 0000000..800e75e --- /dev/null +++ b/Success/templates/registration/resend_activation_complete.html @@ -0,0 +1,22 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Account Activation Resent" %}{% endblock %} + +{% block content %} +

+ {% blocktrans %} + We have sent an email to {{ email }} with further instructions. + {% endblocktrans %} +

+{% endblock %} + + +{% comment %} +**registration/resend_activation_complete.html** +Used after form for resending account activation is submitted. By default has +the following context: + +``email`` + The email address submitted in the resend activation form. +{% endcomment %} diff --git a/Success/templates/registration/resend_activation_form.html b/Success/templates/registration/resend_activation_form.html new file mode 100644 index 0000000..400384d --- /dev/null +++ b/Success/templates/registration/resend_activation_form.html @@ -0,0 +1,25 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} + +{% block title %}{% trans "Resend Activation Email" %}{% endblock %} + +{% block content %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} + + +{% comment %} +**registration/resend_activation_form.html** +Used to show the form users will fill out to resend the activation email. By +default, has the following context: + +``form`` + The registration form. This will be an instance of some subclass + of ``django.forms.Form``; consult `Django's forms documentation + `_ for + information on how to display this in a template. +{% endcomment %} diff --git a/Success/tests.py b/Success/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/Success/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/Success/urls.py b/Success/urls.py new file mode 100644 index 0000000..be3836b --- /dev/null +++ b/Success/urls.py @@ -0,0 +1,22 @@ +from django.conf.urls import url,include +from Success import views +from django.contrib import admin +from django.urls import include, path +from django.conf.urls.static import static +from django.conf import settings + +urlpatterns = [ + + + + +################################################################################################################################################################################# +#URL FOR HOME PAGE +################################################################################################################################################################################# + + #HOME Page url! + + #This is the home page url pattern + path(r'', views.index, name= 'index'), +] + diff --git a/Success/views.py b/Success/views.py new file mode 100644 index 0000000..7398e2a --- /dev/null +++ b/Success/views.py @@ -0,0 +1,32 @@ +from django.shortcuts import render + +#---------------------------------------------------------------------# +'''End Of Import''' +#---------------------------------------------------------------------# + +# VIEW FUNCTIONS HERE! + + + +################################################################################################################################################################################# +#HOME PAGE VIEW FUNCTION +################################################################################################################################################################################# + +#Home page view function +def index(request): + title = 'Welcome: This is the Home Page' + context = { + "title": title, + } + return render(request, "Success/index.html",context) + +################################################################################################################################################################################# +#REGISTRATION & LOGIN PAGE VIEW FUNCTION +################################################################################################################################################################################# + + +#Registration & Login page view function +def login(request): + return render(request, 'Registration/login.html') + +################################################################################################################################################################################# \ No newline at end of file diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..be2c763 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Login.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/newDjango.sh b/newDjango.sh deleted file mode 100755 index 9e86be5..0000000 --- a/newDjango.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/sh - -# Creating new app -mkdir ${1} -cd ${1} -# Creating virtual folder -chmod a+x newDjango.sh - -python3.6 -m venv virtual - -source virtual/bin/activate -Initializing git -git init -touch .gitignore -touch README.md -cat >> README.md << EOF -# ${1} - -# Description - -# Prerequisites - -# Setup/Installation Reqiurements. -**{follow the below instructions for set up.}** - -# Technologies Used - -# Support and Contact - --Mobile number: (+254) 798731203 - --Email Address: collo.kariss@gmail.com - --github-username: zecollokaris - -## License - -The app is licensed by MIT. - -Collins Kariuki - MIT (c)2018 LICENSE - - - -EOF -mkdir static -cd static -mkdir css -cd css -touch ${2}.css -cd ../../ - -cat >> .gitignore << EOF - -virtual/ -*.pyc -.env -migrations/ - -EOF - -# Installing dependencies -pip install Django==2.0.7 -pip install django-bootstrap4 pillow -pip install dj-database-url gunicorn psycopg2 whitenoise python-decouple -pip install wheel - -django-admin startproject ${1} . -django-admin startapp ${2} - -# Creating Folder -cd ${2} -# defining the app urls -touch urls.py - -cat >> urls.py<< EOF -from django.conf.urls import url,include -from . import views -from django.contrib import admin -from django.conf.urls.static import static -from django.conf import settings - -urlpatterns = [ - url(r'^$', views.index, name= 'index'), -] - -EOF - -mkdir templates templates/${2}/ -cd templates/${2}/ - -# creating the templates -touch base.html index.html - -# Filling the base.html file -cat >> base.html<< EOF -{%load bootstrap4 %} -{% load static %} - - - - ${1} -{%block styles%} -{%bootstrap_css%} - -{% endblock %} - - - -{%block content%} -{% endblock %} -{% block scripts %} - - - {% bootstrap_javascript %} {% endblock %} - - - -EOF -cat >> index.html << EOF -{%extends '${2}/base.html'%} -{%block content%} -EOF -cd ../../../ - -# Getting requirements -pip freeze > requirements.txt - -# Creating procfile -touch Procfile - -# Configuring procfile -cat >> Procfile << EOF -web: gunicorn ${1}.wsgi -EOF -# creating env file -touch .env - -cat>> .env << EOF -DEBUG = True - -EOF - - -# Creating initial commit -git add . - -git commit -m "Initial Commit" - -# enter psql -psql - -# Open code -code . - -# Delete Shell Script -rm -f newDjango.sh \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..92fdd87 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,92 @@ +appdirs==1.4.4 +apturl==0.5.2 +asgiref==3.3.1 +bcrypt==3.1.7 +beautifulsoup4==4.9.3 +blinker==1.4 +Brlapi==0.7.0 +certifi==2019.11.28 +chardet==3.0.4 +Click==7.0 +colorama==0.4.3 +command-not-found==0.3 +cryptography==2.8 +cupshelpers==1.0 +dbus-python==1.2.16 +defer==1.0.6 +distlib==0.3.1 +distro==1.4.0 +distro-info===0.23ubuntu1 +dj-database-url==0.5.0 +Django==3.1.7 +django-bootstrap==0.2.4 +django-bootstrap3==14.2.0 +django-bootstrap4==2.3.1 +django-registration-redux==2.9 +duplicity==0.8.12.0 +entrypoints==0.3 +fasteners==0.14.1 +filelock==3.0.12 +future==0.18.2 +gunicorn==20.0.4 +httplib2==0.14.0 +idna==2.8 +importlib-metadata==1.5.0 +keyring==18.0.1 +keyrings.alt==3.4.0 +language-selector==0.1 +launchpadlib==1.10.13 +lazr.restfulclient==0.14.2 +lazr.uri==1.0.3 +lockfile==0.12.2 +louis==3.12.0 +macaroonbakery==1.3.1 +Mako==1.1.0 +MarkupSafe==1.1.0 +monotonic==1.5 +more-itertools==4.2.0 +netifaces==0.10.4 +oauthlib==3.1.0 +olefile==0.46 +paramiko==2.6.0 +pexpect==4.6.0 +Pillow==7.1.0 +protobuf==3.6.1 +psycopg2==2.8.6 +pycairo==1.16.2 +pycrypto==2.6.1 +pycups==1.9.73 +PyGObject==3.36.0 +PyJWT==1.7.1 +pymacaroons==0.13.0 +PyNaCl==1.3.0 +pyRFC3339==1.1 +python-apt==2.0.0+ubuntu0.20.4.1 +python-dateutil==2.7.3 +python-debian===0.1.36ubuntu1 +python-decouple==3.4 +pytz==2019.3 +pyxdg==0.26 +PyYAML==5.3.1 +reportlab==3.5.34 +requests==2.22.0 +requests-unixsocket==0.2.0 +SecretStorage==2.3.1 +simplejson==3.16.0 +six==1.14.0 +soupsieve==2.2 +sqlparse==0.4.1 +system-service==0.3 +systemd-python==234 +ubuntu-advantage-tools==20.3 +ubuntu-drivers-common==0.0.0 +ufw==0.36 +unattended-upgrades==0.1 +urllib3==1.25.8 +usb-creator==0.3.7 +virtualenv==20.4.2 +wadllib==1.3.3 +whitenoise==5.2.0 +xkit==0.0.0 +zipp==1.0.0 +zope.interface==4.7.1 diff --git a/static/css/Success.css b/static/css/Success.css new file mode 100644 index 0000000..e69de29 diff --git a/virtual/bin/activate b/virtual/bin/activate new file mode 100644 index 0000000..aa6110c --- /dev/null +++ b/virtual/bin/activate @@ -0,0 +1,76 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # This should detect bash and zsh, which have a hash command that must + # be called to get it to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r + fi + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + if [ ! "$1" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV="/home/karis/Desktop/POS-System/virtual" +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + if [ "x(virtual) " != x ] ; then + PS1="(virtual) ${PS1:-}" + else + if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" + else + PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" + fi + fi + export PS1 +fi + +# This should detect bash and zsh, which have a hash command that must +# be called to get it to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r +fi diff --git a/virtual/bin/activate.csh b/virtual/bin/activate.csh new file mode 100644 index 0000000..729c8b0 --- /dev/null +++ b/virtual/bin/activate.csh @@ -0,0 +1,37 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV "/home/karis/Desktop/POS-System/virtual" + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/bin:$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + if ("virtual" != "") then + set env_name = "virtual" + else + if (`basename "VIRTUAL_ENV"` == "__") then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` + else + set env_name = `basename "$VIRTUAL_ENV"` + endif + endif + set prompt = "[$env_name] $prompt" + unset env_name +endif + +alias pydoc python -m pydoc + +rehash diff --git a/virtual/bin/activate.fish b/virtual/bin/activate.fish new file mode 100644 index 0000000..6369c01 --- /dev/null +++ b/virtual/bin/activate.fish @@ -0,0 +1,75 @@ +# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) +# you cannot run it directly + +function deactivate -d "Exit virtualenv and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + functions -e fish_prompt + set -e _OLD_FISH_PROMPT_OVERRIDE + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + + set -e VIRTUAL_ENV + if test "$argv[1]" != "nondestructive" + # Self destruct! + functions -e deactivate + end +end + +# unset irrelevant variables +deactivate nondestructive + +set -gx VIRTUAL_ENV "/home/karis/Desktop/POS-System/virtual" + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/bin" $PATH + +# unset PYTHONHOME if set +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # save the current fish_prompt function as the function _old_fish_prompt + functions -c fish_prompt _old_fish_prompt + + # with the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command + set -l old_status $status + + # Prompt override? + if test -n "(virtual) " + printf "%s%s" "(virtual) " (set_color normal) + else + # ...Otherwise, prepend env + set -l _checkbase (basename "$VIRTUAL_ENV") + if test $_checkbase = "__" + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) + else + printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) + end + end + + # Restore the return status of the previous command. + echo "exit $old_status" | . + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" +end diff --git a/virtual/bin/python b/virtual/bin/python new file mode 120000 index 0000000..039b719 --- /dev/null +++ b/virtual/bin/python @@ -0,0 +1 @@ +python3.6 \ No newline at end of file diff --git a/virtual/bin/python3 b/virtual/bin/python3 new file mode 120000 index 0000000..039b719 --- /dev/null +++ b/virtual/bin/python3 @@ -0,0 +1 @@ +python3.6 \ No newline at end of file diff --git a/virtual/bin/python3.6 b/virtual/bin/python3.6 new file mode 120000 index 0000000..6270541 --- /dev/null +++ b/virtual/bin/python3.6 @@ -0,0 +1 @@ +/usr/bin/python3.6 \ No newline at end of file diff --git a/virtual/lib64 b/virtual/lib64 new file mode 120000 index 0000000..7951405 --- /dev/null +++ b/virtual/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/virtual/pyvenv.cfg b/virtual/pyvenv.cfg new file mode 100644 index 0000000..77a4fd7 --- /dev/null +++ b/virtual/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /usr/bin +include-system-site-packages = false +version = 3.6.13