update readmes, and add a few more

This commit is contained in:
Ronny Abraham 2019-06-21 14:56:08 +03:00
parent 01c122ffcb
commit 0c50929581
6 changed files with 121 additions and 22 deletions

View file

@ -234,6 +234,7 @@ AWS has a sudo group that allows a user sudo priveleges
### install python packages
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install libjpeg-dev

View file

@ -22,11 +22,11 @@
github url [django sass processor](https://github.com/jrief/django-sass-processor)
`pip install django-sass-processor`
pip install django-sass-processor
### add to installed apps
`sass_processor`
sass_processor
### additional configuration settings
@ -34,22 +34,23 @@ github url [django sass processor](https://github.com/jrief/django-sass-processo
sass processor searches template files to find links to sass stylesheets. If using templates with a .django extension, you have to set the ext types you want the processor to search
`SASS_TEMPLATE_EXTS = ['.django', '.html']`
SASS_TEMPLATE_EXTS = ['.django', '.html']
#### file search root directory
set the root value for which sass processor will search for sass files (set to the same value as static root)
`SASS_PROCESSOR_ROOT = STATIC_ROOT`
SASS_PROCESSOR_ROOT = STATIC_ROOT
#### add cssfinder to static file finders
we need to tell the static finders thingie to use sass_processor
`STATICFILES_FINDERS = [`
` 'django.contrib.staticfiles.finders.FileSystemFinder',`
` 'django.contrib.staticfiles.finders.AppDirectoriesFinder', `
` 'sass_processor.finders.CssFinder', ]`
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'sass_processor.finders.CssFinder',
]
#### directories to look through
@ -57,27 +58,36 @@ you must tell django wher eto find static files that you want to look through if
you must also tell the sass processor where those files are if you want the sass processor to be able to do anything with it
`STATICFILES_DIRS = [`
` ('node_modules', os.path.join(PROJECT_ROOT, 'share/media/node_modules/')),`
` os.path.join(PROJECT_ROOT,'share/media/node_modules/foundation-sites/scss'), ]`
STATICFILES_DIRS = [
('node_modules',
os.path.join(
PROJECT_ROOT,
'share/media/node_modules/')),
os.path.join(
PROJECT_ROOT,
'share/media/node_modules/foundation-sites/scss'),
]
`SASS_PROCESSOR_INCLUDE_DIRS = [`
` os.path.join(PROJECT_ROOT, 'share/media/node_modules'),`
` os.path.join(PROJECT_ROOT, 'share/media/node_modules/foundation-sites/scss'), ]`
SASS_PROCESSOR_INCLUDE_DIRS = [
os.path.join(PROJECT_ROOT, 'share/media/node_modules'),
os.path.join(PROJECT_ROOT,
'share/media/node_modules/foundation-sites/scss'),
]
Notice how "node modules" is attached without a prefix.
also, I add direct links to the scss of the underlying packages so I can import them with a direct command
`@import foundation`
@import foundation
_instead of_
`@import foundation-sites/scss/foundation`
@import foundation-sites/scss/foundation
When you want to import sass modules underneath the "node_modules" directory you must refer to the directory structure _underneath_ the node modules structure:
`@import foundation-sites/scss/foundation`
@import foundation-sites/scss/foundation
however, to directly import the foundation sass library, you must do so through the "assets" directory referenced in static.
@ -85,10 +95,10 @@ so foundation-sites/assets refers to what will be used in static, and foundation
### Usage
`{% load sass_tags %}`
{% load sass_tags %}
`<link href="{% sass_src 'myapp/css/mystyle.scss' %}"`
`rel="stylesheet" type="text/css" />`
<link href="{% sass_src 'myapp/css/mystyle.scss' %}"
rel="stylesheet" type="text/css" />
## installing Zurb Foundation Template
@ -98,11 +108,12 @@ so foundation-sites/assets refers to what will be used in static, and foundation
either open up the virtualenv that contains foundation-cli or create one, or just install foundation-cli
create a new template
`foundation new`
foundation new
## installing via foundation-sites
npm install foundation-sites
npm install foundation-sites

View file

@ -0,0 +1,25 @@
##if you get the following error:
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
you must install on the host machine the following packages:
`sudo apt-get install binutils libproj-dev gdal-bin`
next you must update POstgres to use POSTGIS
[https://docs.djangoproject.com/en/2.1/ref/contrib/gis/install/postgis/](https://docs.djangoproject.com/en/2.1/ref/contrib/gis/install/postgis/)
## update postgres
### the following packages must be installed:
(x.x matching the PostgreSQL version you want to install)
postgresql-x.x
postgresql-x.x-postgis
postgresql-server-dev-x.x
python-psycopg2
find out the postgres server number:
`apt list --installed | grep 'post'`

View file

@ -0,0 +1,15 @@
`Host **my-remote-server**` *a symbolic name of your choice*
`Hostname **server-IP-or-DNS**` *the real name*
`User **username**` *the username you use for login*
`IdentityFile ~/.ssh/a_suitable_ssh_key_if_any` *for authentication purposes*
`ControlMaster auto`
`ControlPath ~/.ssh/%C`
*or* `~/.ssh/%h-%p-%r` *for older versions*
`ControlPersist 5m` *or* `yes` *for never expiring persistent connection*

View file

@ -0,0 +1,2 @@
node.js
https://lincolnloop.com/blog/installing-nodejs-and-npm-python-virtualenv/

View file

@ -0,0 +1,45 @@
# Social Auth notes
## basic python_social_auth
### How to Add Social Login to Django
[How to Add Social Login to Django](https://simpleisbetterthancomplex.com/tutorial/2016/10/24/how-to-add-social-login-to-django.html)
#### pre test notes
1. disable 'test_social.middleware.ForwardHQMiddleware'
2. reset LOGIN_REDIRECT_URL = '/tsoc' or to wherever you want it to land
3. set SOCIAL_AUTH_URL_NAMESPACE = 'social'
4. DON'T use localhost if you plan on using twitter, twitter doesn't like it
#### error in login
[stackoverflow desc](https://stackoverflow.com/questions/46975657/attributeerror-module-django-contrib-auth-views-has-no-attribute-login)
change:
`path('login/', views.login, name='login')`
`path('login/', views.LoginView.as_view(template_name="registration/login.django"), name='login')`
#### when making callback urls
- you can use localhost
- you can also specify a port on localhost, e.g. http://localhost:8026
- you can also use minyanfinder.stg or any .stg
- make sure to specify the "u" letter in oauth
- make sure to add the final forward slash "/" at the end of the callback url
`minyanfinder.stg/oauth/complete/twitter/`
## global variables
global variables should be in settings.py
local info like the specific client id/secret key, etc, should be in the local setting sfiles
test_social should only be activated in the local setting files
### twitter notes
1. you want to either use http or https, be specific
2. twitter does not use localhost and forwardhq is buggy
3. twitter DOES register 127.0.0.1:8026 as a callback