Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScrapyTutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton Gusev
ScrapyTutorial
Commits
b81a8214
You need to sign in or sign up before continuing.
Commit
b81a8214
authored
5 years ago
by
Anton Gusev
Browse files
Options
Downloads
Patches
Plain Diff
add DB_CHARSET params to settings
parent
6fabb98d
No related branches found
No related tags found
2 merge requests
!5
Develop
,
!4
Develop
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
src/.env.example
+1
-0
1 addition, 0 deletions
src/.env.example
src/alembic.ini.example
+1
-1
1 addition, 1 deletion
src/alembic.ini.example
src/settings.py
+4
-1
4 additions, 1 deletion
src/settings.py
with
8 additions
and
3 deletions
.gitignore
+
2
−
1
View file @
b81a8214
...
@@ -7,4 +7,5 @@ alembic.ini
...
@@ -7,4 +7,5 @@ alembic.ini
__pycache__
__pycache__
*.json
*.json
src/spiders/Test*.py
src/spiders/Test*.py
*.log
*.log
\ No newline at end of file
statistics.txt
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/.env.example
+
1
−
0
View file @
b81a8214
...
@@ -6,6 +6,7 @@ DB_PORT=3306
...
@@ -6,6 +6,7 @@ DB_PORT=3306
DB_DATABASE=database
DB_DATABASE=database
DB_USERNAME=username
DB_USERNAME=username
DB_PASSWORD=secret
DB_PASSWORD=secret
DB_CHARSET=utf8mb4
### MAIL CONFIG
### MAIL CONFIG
MAIL_FROM = 'example@example.com'
MAIL_FROM = 'example@example.com'
...
...
This diff is collapsed.
Click to expand it.
src/alembic.ini.example
+
1
−
1
View file @
b81a8214
...
@@ -36,7 +36,7 @@ script_location = database
...
@@ -36,7 +36,7 @@ script_location = database
# output_encoding = utf-8
# output_encoding = utf-8
# sqlalchemy.url = driver://user:pass@host:port/dbname
# sqlalchemy.url = driver://user:pass@host:port/dbname
sqlalchemy.url = mysql+pymysql://user:password@localhost/databasename
sqlalchemy.url = mysql+pymysql://user:password@localhost/databasename
?utf8mb4
# Logging configuration
# Logging configuration
...
...
This diff is collapsed.
Click to expand it.
src/settings.py
+
4
−
1
View file @
b81a8214
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
logging
import
logging
from
dotenv
import
load_dotenv
from
dotenv
import
load_dotenv
import
os
import
os
true_list
=
[
'
True
'
,
'
true
'
,
'
TRUE
'
,
1
,
'
1
'
]
true_list
=
[
'
True
'
,
'
true
'
,
'
TRUE
'
,
1
,
'
1
'
]
load_dotenv
()
load_dotenv
()
...
@@ -103,13 +104,15 @@ DB_PASSWORD = os.getenv('DB_PASSWORD')
...
@@ -103,13 +104,15 @@ DB_PASSWORD = os.getenv('DB_PASSWORD')
DB_HOST
=
os
.
getenv
(
'
DB_HOST
'
)
DB_HOST
=
os
.
getenv
(
'
DB_HOST
'
)
DB_PORT
=
int
(
os
.
getenv
(
'
DB_PORT
'
))
DB_PORT
=
int
(
os
.
getenv
(
'
DB_PORT
'
))
DB_DATABASE
=
os
.
getenv
(
'
DB_DATABASE
'
)
DB_DATABASE
=
os
.
getenv
(
'
DB_DATABASE
'
)
CONNECTION_STRING
=
"
{drivername}://{user}:{passwd}@{host}:{port}/{db_name}?charset=utf8
"
.
format
(
DB_CHARSET
=
os
.
getenv
(
'
DB_CHARSET
'
)
CONNECTION_STRING
=
"
{drivername}://{user}:{passwd}@{host}:{port}/{db_name}?charset={db_charset}
"
.
format
(
drivername
=
DB_CONNECTION
,
drivername
=
DB_CONNECTION
,
user
=
DB_USERNAME
,
user
=
DB_USERNAME
,
passwd
=
DB_PASSWORD
,
passwd
=
DB_PASSWORD
,
host
=
DB_HOST
,
host
=
DB_HOST
,
port
=
str
(
DB_PORT
),
port
=
str
(
DB_PORT
),
db_name
=
DB_DATABASE
,
db_name
=
DB_DATABASE
,
db_charset
=
DB_CHARSET
,
)
)
# Logger config
# Logger config
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment