Skip to main content

Aparnik is a simple Django app to help about some common problems.

Project description

============ Aparnik

Aparnik is a simple Django app to help about some common problems. For each question, visitors can choose between a fixed number of answers.

Detailed documentation is in the "docs" directory.

Quick start

  1. Use your custom module.

  2. Add dependency:


     # app
  3. Add config to settings if you want:

    APARNIK = {

     'API_PRODUCT_MODE': True,
     'AWS_ACTIVE': True,
     'BANK_ACTIVE': True,
     'ZARINPAL_MERCHENT_CODE': '123123123123',


    CKEDITOR_CONFIGS = { 'basic': { 'toolbar': 'Basic', }, }


    FCM_DJANGO_SETTINGS = { 'FCM_SERVER_KEY': NOTIFICATION_API_KEY, # true if you want to have only one active device per registered user at a time # default: False 'ONE_DEVICE_PER_USER': False, # devices to which notifications cannot be sent, # are deleted upon receiving error response from FCM # default: False 'DELETE_INACTIVE_DEVICES': False, }


    AWS_HEADERS = { # see 'Expires': 'Thu, 31 Dec 2099 20:00:00 GMT', 'Cache-Control': 'max-age=94608000', }


    if not AWS_SECRET_ACCESS_KEY or not AWS_ACCESS_KEY_ID or not AWS_STORAGE_BUCKET_NAME: raise ValueError('AWS KEY does not set')

    S3DIRECT_REGION = os.environ.get('S3DIRECT_REGION', 'us-east-1')

    Tell django-storages that when coming up with the URL for an item in S3 storage, keep

    it simple - just use this domain plus the path. (If this isn't set, things get complicated).

    This controls how the static template tag from staticfiles gets expanded, if you're using it.

    We also use it in the next setting.



    This is used by the static template tag from static, if you're using that. Or if anything else

    refers directly to STATIC_URL. So it's safest to always set it.

    STATICFILES_LOCATION = 'static' STATICFILES_STORAGE = 'custom_storages.StaticStorage' STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)

    STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

    STATIC_URL = '/static/'


    MEDIAFILES_LOCATION = 'media' MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION) DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'

    def create_filename(filename): import uuid ext = filename.split('.')[-1] filename = '%s.%s' % (uuid.uuid4().hex, ext) return os.path.join('files', filename)

    def create_file_filename(filename): import uuid ext = filename.split('.')[-1] filename = '%s.%s' % (uuid.uuid4().hex, ext) return os.path.join('file', filename)

    S3DIRECT_DESTINATIONS = { # Allow anybody to upload any MIME type # 'misc': { # 'key': '/' # },

     # Allow staff users to upload any MIME type
     # 'pdfs': {
     #     'key': 'uploads/pdfs',
     #     'auth': lambda u: u.is_staff
     # },
     # Allow anybody to upload jpeg's and png's. Limit sizes to 500b - 4mb
     'images': {
         # 'key': 'uploads/images',
         'key': create_filename,
         'auth': lambda u: u.is_authenticated,
         'allowed': [
         'content_length_range': (500, 4000000),
     # Allow authenticated users to upload mp4's
     'videos': {
         # 'key': 'uploads/videos',
         'key': create_filename,
         'auth': lambda u: u.is_authenticated,
         'allowed': ['video/mp4']
     'file': {
         # 'key': 'uploads/videos',
         'key': create_file_filename,
         'auth': lambda u: u.is_authenticated,
         # TODO: add mime type
         # 'allowed': ['application/octet-stream ipa']
     # Allow anybody to upload any MIME type with a custom name function
     # 'custom_filename': {
     #     'key': create_filename
     # },


  4. Add to urls

    url(r'^admin/dynamic_raw_id/', include('dynamic_raw_id.urls')), url(r'^api/v1/aparnik/', include('aparnik.urls.api', namespace='aparnik-api')), url(r'^aparnik/', include('aparnik.urls.urls', namespace='aparnik')), url(r'^ckeditor/', include('ckeditor_uploader.urls')),

  5. Add clock to procfile

  6. Add line below to

    from aparnik.clock import *

  7. Add settings key:

    'LOGO_PROJECT_ICON' = '' # لوگو 'SERVER_NAME' = '' # آدرس سایت 'SERVER_PORT' = '80' # پورت سایت 'PRODUCT_WALLET_ID' = 168 # شارژ کیف پول 'COURSE_LEVEL' = 2 # سطح دوره 'INVITER_GIFT_CREDITS_PER_PURCHASE' = 0 # درصد اعتبار هدیه برای دعوت کننده به ازای هر خرید 'INVITER_GIFT_CREDITS' = 20000 # اعتبار هدیه برای دعوت کننده در بدو قبول دعوت تومان 'PRICE_FORMAT' = '%ic=t:%se=,:%cu=t:%gr=3:%tr=True:%abbr=True' # فرمت قیمت ها 'PRICE_PRODUCT_FREE_DESCRIPTION' = 'Free' # عنوان کالاهای رایگان 'PRICE_PRODUCT_SHARING_DESCRIPTION' = 'Shared' # عنوان کالاهایی که دعوت شده اند 'PRICE_PRODUCT_BUY_DESCRIPTION' = 'Bought' # عنوان کالاهای خریداری شده

  8. Add this line to url

    handler404 = 'aparnik.contrib.suit.views.handler404' handler500 = 'aparnik.contrib.suit.views.handler500'

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-aparnik, version
Filename, size File type Python version Upload date Hashes
Filename, size django-aparnik- (2.0 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page