Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

production.py setting not migrating nor collectstatic files properly & OSError: [Errno 30] Read-only file system #1

Open
rahul6612 opened this issue Apr 14, 2018 · 1 comment

Comments

@rahul6612
Copy link
Owner

i deployed my website on heroku but when i am trying to run this command **heroku run python manage.py collectstatic ** its show the error OSError: [Errno 30] Read-only file system: '/static_in_env' and the majaor problem is that it try to collect static files according to directory of local.py settings not production.py setting. and
when i run the command heroku run python manage.py migrate its showing this
heroku run python manage.py migrate Running python manage.py migrate on ⬢ flyingstore... up, run.3581 (Free) Operations to perform: Synchronize unmigrated apps: django_filters, crispy_forms, staticfiles, messages Apply all migrations: orders, admin, sites, products, auth, sessions, carts, contenttypes, registration, newsletter Synchronizing apps without migrations: Creating tables... Running deferred SQL... Installing custom SQL... Running migrations: No migrations to apply.

HERE is my production.py file is
`
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__))))

SECRET_KEY = 'csqwlmc8s55o($rt6ozh7u+ui9zb-et00w$d90j8$^!nvj41_r'

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

ADMINS = (
	("rahul", "[email protected]"),

	)

ALLOWED_HOSTS = ["flyingstore.herokuapp.com"]


EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_PORT = 587
EMAIL_USE_TLS = True


# 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',

	'crispy_forms',
	'django_filters',
	'registration',

	'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


# 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


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, "static-storage"),
)
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'


STATIC_ROOT = os.path.join(BASE_DIR, 'live-static-files', 'static-root')
MEDIA_ROOT = os.path.join(BASE_DIR, 'live-static-files', '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_PUBLIC = "2f8dqqhqs7wz95t8"
BRAINTREE_PRIVATE = "9d2f9ddfaefd81d6af09d537017d86c4"
BRAINTREE_MERCHANT_ID = "68nvwyj4qsz7rnzc"
BRAINTREE_ENVIRONEMNT = "Sandbox" `

The STATIC_ROOT and MEDIA_ROOT configuration is like this
src(root of my application) inside src manage.py file is there src--->manage.py live-static-files (folder as same label of manage.py file)--->media-root(folder inside live-static-files) static-root(same label on media-root)

when i am running heroku run python manage.py collectstatic then it try to collect static file here

/static_in_env which is in my ## local.py file
why its happening even my local.py file is inside the .gitignore file
it should collect the staticfiles here '/live-static-files' ' according to my production.py settings
but its try to do according local.py settings

please tell me what should i do so it work fine

@rahul6612 rahul6612 changed the title production setting not migrating nor collectstatic files production.py setting not migrating nor collectstatic files properly & OSError: [Errno 30] Read-only file system Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants