Git Product home page Git Product logo

staffmanagerapp's Introduction

management

The staff management is a simple Django app to perform crud commands on employees.

steps:

# Steps are incoherent, do not follow, need to rewrite

  1. This web-app requires django 2.0 and python 3.5.
  1. No DB settings is needed as sqlite3 is used by default.
  1. create a virtual env.

    -> python3 -m venv vp or virtualenv -p python3.5 venv

  2. Activate vp and run "pip install -e staffmanager_package"

  3. Create a project, "django-admin startproject staffmanager"

    • Add "staffapp.apps.StaffAppConfig" to your INSTALLED_APPS setting like this:

      INSTALLED_APPS = [

      'staffapp.apps.StaffAppConfig', ...

      ]

    • Add the following settings in your settings.py

      -> MEDIA_URL = '/media/' -> MEDIA_ROOT = os.path.join(BASE_DIR, 'staffapp/media')

  4. Include the following into URLconf in your project urls.py like this:

    from django.urls import path, include
    from django.contrib import admin
    from django.conf import settings
    from django.conf.urls.static import static
    from staffmanager import views
    urlpatterns = [
        path('admin/', admin.site.urls),
        path('', views.redirect_employee),
        path('staff_management', views.redirect_employee),
        path('staff_management/', include('staffapp.urls')),
    ]
    
    if settings.DEBUG:
        urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    
  5. create a views.py in your project and add the following:

    from django.shortcuts import redirect, reverse

    def redirect_employee(request):

    """ :param request: :return: Redirects the user to a valid page """ return redirect(reverse('emp:view_employees'))

  6. Run python manage.py makemigrattions.

  7. Run python manage.py migrate to create the employee models.

  8. Run python manage.py insert_test_users to create the forecast models.

  9. Visit http://127.0.0.1:8000 to view the site.

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.