rahul6612 / flying-store

i want to add code print("hello world") in drdo_tracker.py file and when i run my plugin the output (hello word) shown in QGIS python console. How can i do this?
0 stars 0 forks source link

why images not showing on live site #2

Open rahul6612 opened 6 years ago

rahul6612 commented 6 years ago

After deploying my site on heroku its not showing the images i uses aws s3 bucket to store those images but its not rendring thoes images from s3 bucket please tell me what i should do?

**i think error in static root and media root paths please check it

First read this

my static_in_env folder is same label on src and manage.py is inside the src inside the static_in_env folder there is 2 more folder media_root and static_root

the forlder live-static-files is inside the src folder and live-static-files folder contain to more folders media-root and static-root**

so please tell me the correct path to show the images on my site `

here is my production.py code

from django.conf import settings

if not settings.DEBUG: import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
#root of project

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'csqwlmc8s55o($rt6ozh7u+ui9zb-et00w$d90j8$^!nvj41_r'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ADMINS = (
    ("rahul", "rahulverma6612@gmail.com"),

    )

ALLOWED_HOSTS = ["flyingstore.herokuapp.com"]
#purchasing domain name http://name.com

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'yourgmail@gmail.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_PORT = 587
EMAIL_USE_TLS = True

''' 
If using gmail, you will need to
unlock Captcha to enable Django 
to  send for you:
https://accounts.google.com/displayunlockcaptcha
'''

# Application definition

INSTALLED_APPS = (
    # django app
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # third party apps
    'crispy_forms',
    'django_filters',
    'registration',
    # my apps
    'carts',
    'newsletter',
    'orders',
    'products',
    'storages',
    'boto',
)
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'ecommerce2.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 = 'ecommerce2.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases

# from .db_password import DBPASS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'flying_store',
        'USER': "postgres",
        'PASSWORD': 'Rahul6612x',
        'HOST': '',
        'PORT': ''
    }
}
import dj_database_url

db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)

# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

STATIC_URL = '/static/'
MEDIA_URL = '/media/'

STATICFILES_DIRS = (
    # os.path.join(BASE_DIR, 'live-static-files', 'static-root'),

      os.path.join(BASE_DIR, "static_in_env", "static_root"),
    # os.path.join(BASE_DIR, "static_in_env", "static_root"),
    # os.path.join(BASE_DIR, 'static_in_pro', 'our_static'),

)

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

MEDIA_ROOT = os.path.join(BASE_DIR, 'live-static-files', 'media-root')
STATIC_ROOT = os.path.join(BASE_DIR, 'live-static-files', 'static-root')

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env", "static_root")
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env", "media_root")

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',

)

#Crispy FORM TAGs SETTINGS
CRISPY_TEMPLATE_PACK = 'bootstrap3'

#DJANGO REGISTRATION REDUX SETTINGS
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True
SITE_ID = 1
LOGIN_REDIRECT_URL = '/'

Braintree Payments Details

BRAINTREE_PUBLIC = "2f8dqqhqs7wz95t8" BRAINTREE_PRIVATE = "9d2f9ddfaefd81d6af09d537017d86c4" BRAINTREE_MERCHANT_ID = "68nvwyj4qsz7rnzc" BRAINTREE_ENVIRONEMNT = "Sandbox"

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "") AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY", "") AWS_STORAGE_BUCKET_NAME = os.environ.get("AWS_STORAGE_BUCKET_NAME", "") AWS_QUERYSTRING_AUTH = False AWS_S3_CUSTOM_DOMAIN = os.environ.get("AWS_S3_CUSTOM_DOMAIN", "") MEDIA_ROOT = os.environ.get("MEDIA_URL", "") MEDIA_URL = '/media/'

policy bucket

#

{

"Id": "Policy1523650910560",

"Version": "2012-10-17",

"Statement": [

{

"Sid": "Stmt1523650506510",

"Action": [

"s3:GetObject"

],

"Effect": "Allow",

"Resource": "arn:aws:s3:::flying-media/*",

"Principal": "*"

},

{

"Sid": "Stmt1523650864642",

"Action": "s3:*",

"Effect": "Allow",

"Resource": [

"arn:aws:s3:::flying-media/*",

"arn:aws:s3:::darkmachine"

],

"Principal": {

"AWS": [

"arn:aws:iam::033265322119:user/rahul6612"

]

}

}

]

}

`