Skip to main content

python basecode package(api,admin panel)

Project description

===== authentication(user api),CMS

BaseCode of Space-o Technology Detailed documentation is in the "docs" directory.

Quick start


  1. include in settings.py :

INSTALLED_APPS = [ 'jazzmin', . . .
'CMS',
'authentication' ,
'debug_toolbar',
'tinymce',
'rest_framework',
'drf_spectacular', 'rest_framework_simplejwt', ]

#add middel ware MIDDLEWARE = [ "debug_toolbar.middleware.DebugToolbarMiddleware" ... ... ... 'authentication.custom_middleware.simple_middleware',

]

#for password hashing PASSWORD_HASHERS = [ 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', 'django.contrib.auth.hashers.PBKDF2PasswordHasher', 'django.contrib.auth.hashers.Argon2PasswordHasher', ] #add language LANGUAGE_CODE = 'en-us' LANGUAGES = [ ('en', ('English')), ('hi', ('hindi')), ] TIME_ZONE = 'Asia/Kolkata'

#rest framework REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [], 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', }

#Spectacular SPECTACULAR_SETTINGS = { 'PREPROCESSING_HOOKS': ["Custom.url_remover.preprocessing_filter_spec"] }

#add custom user AUTH_USER_MODEL = "authentication.User"

#add admin pannel jazzmin settings JAZZMIN_SETTINGS = { "language_chooser": True, "site_title": "Django", "show_ui_builder" : True, "copyright": "Space-O", "navigation_expanded": False,
"related_modal_active": False, "site_brand": "BaseCode", "welcome_sign": "welcome to www.site.com", "icons": { "auth": "fas fa-users-cog", "authentication.user": "fas fa-user", "auth.Group": "fas fa-users", "cms.Cms":"fas fa-regular fa-keyboard", "authentication.setting":"fas fa-edit", "authentication.mobile":"fa fa-mobile"
},

} JAZZMIN_UI_TWEAKS = { "theme": 'litera', }

  1. Include all this in your project urls.py like this::

urlpatterns = [ path('debug/',include('debug_toolbar.urls')), path('api-auth/', include('rest_framework.urls')), path('', include('authentication.urls')), path('content-pages/', include('CMS.urls')), path('api/schema/', SpectacularAPIView.as_view(), name='schema'), path('schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'), path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'), ] #reset password for admin pannel urlpatterns += [ path(
'account/reset/', auth_views.PasswordResetView.as_view(), name='admin_password_reset', ),
] #fir language in admin pannel urlpatterns += [path('i18n/', include('django.conf.urls.i18n')),] urlpatterns += i18n_patterns(path('admin/', admin.site.urls))

  1. Run python manage.py makemigrations authentication after Run python manage.py migrate to create the authentication models.

  2. Run python manage.py makemigrations CMS after Run python manage.py migrate to create the authentication models.

  3. Start the development server and visit http://127.0.0.1:8000/admin/

  4. Visit http://127.0.0.1:8000/api/schema/swagger-ui/ to user api

  5. customization- how to import module example- from authentication.view import loginAPIView now you can simplay customiz it

  6. we have three module authentication,BaseCode,CMS and custom authentication- having all api and models CMS-having content api and models custom-having all validation,response and pagination classes BaseCode- having only one module settings.py all setting in this

  7. (OPTIONAL) add this script in your base.html of admin panel

<script> function myFunction(id, elem) { url = 'http://172.16.17.30:8000/verified/inactive/'+id $.ajax({ url: url, success: function(data) { console.log(id) elem.textContent = "Inactive" elem.className = "btn btn-danger btn-sm" }, error:function(a,b,c) { console.log(c); } }); } function myFunctions(id, elem) { url = 'http://172.16.17.30:8000/verified/active/'+id $.ajax({ url: url, success: function(data) { console.log(id, "bha") elem.textContent = "active" elem.className = "btn btn-primary btn-sm" }, error:function(a,b,c) { console.log(c); } }); } function activeInactive(id){ var elem = document.getElementById('myButton'+id) if(elem.textContent == 'active'){ myFunction(id, elem) }else{ myFunctions(id, elem) } } </script>
  1. if you have any query please contact @deppak.spaceo@gmail.com

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

PythonSpaceo-0.0.1.tar.gz (38.2 kB view details)

Uploaded Source

File details

Details for the file PythonSpaceo-0.0.1.tar.gz.

File metadata

  • Download URL: PythonSpaceo-0.0.1.tar.gz
  • Upload date:
  • Size: 38.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for PythonSpaceo-0.0.1.tar.gz
Algorithm Hash digest
SHA256 21749c9e6e1a61071b006bfbc946f5463d961d4f2616c4e5d9d823b65004c155
MD5 fb04210ccfc4e2ebc719b26bf1536000
BLAKE2b-256 210cfbaf70ae391950e06daa019d0b4dc8487ec283ae5c2c7f62e815370482a1

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