Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
warpinfra
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor 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
Sebastian
warpinfra
Commits
a577a226
Commit
a577a226
authored
8 years ago
by
Christian Dresen
Browse files
Options
Downloads
Patches
Plain Diff
Changing to mysql step 1
parent
93119365
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docker-compose.yml
+2
-0
2 additions, 0 deletions
docker-compose.yml
www/Dockerfile
+5
-0
5 additions, 0 deletions
www/Dockerfile
www/web/warppay/views.py
+6
-4
6 additions, 4 deletions
www/web/warppay/views.py
www/web/warpzone/settings.py
+24
-2
24 additions, 2 deletions
www/web/warpzone/settings.py
with
37 additions
and
6 deletions
docker-compose.yml
+
2
−
0
View file @
a577a226
...
@@ -14,8 +14,10 @@ services:
...
@@ -14,8 +14,10 @@ services:
entrypoint
:
/opt/entrypoint_dev.sh
entrypoint
:
/opt/entrypoint_dev.sh
depends_on
:
depends_on
:
-
ldap
-
ldap
-
mysql
links
:
links
:
-
ldap
-
ldap
-
mysql
mysql
:
mysql
:
image
:
mariadb:latest
image
:
mariadb:latest
...
...
This diff is collapsed.
Click to expand it.
www/Dockerfile
+
5
−
0
View file @
a577a226
...
@@ -51,6 +51,11 @@ RUN chmod +x /opt/entrypoint*
...
@@ -51,6 +51,11 @@ RUN chmod +x /opt/entrypoint*
ADD
web /opt/warpinfra/
ADD
web /opt/warpinfra/
ADD
nginx /opt/nginx
ADD
nginx /opt/nginx
RUN
apt-get update
&&
apt-get
install
-y
libmysqlclient-dev
RUN
pip3
install
django-mysql mysqlclient
EXPOSE
8000 443 80
EXPOSE
8000 443 80
VOLUME
["/opt/nginx", "/opt/warpinfra"]
VOLUME
["/opt/nginx", "/opt/warpinfra"]
...
...
This diff is collapsed.
Click to expand it.
www/web/warppay/views.py
+
6
−
4
View file @
a577a226
...
@@ -55,12 +55,15 @@ def user_list(request, user_id = 0):
...
@@ -55,12 +55,15 @@ def user_list(request, user_id = 0):
user
=
UserCredit
.
objects
.
get
(
uid
=
user_id
)
user
=
UserCredit
.
objects
.
get
(
uid
=
user_id
)
if
"
credit
"
in
request
.
data
:
if
"
credit
"
in
request
.
data
:
user
.
credit
=
request
.
data
[
'
credit
'
]
user
.
credit
=
request
.
data
[
'
credit
'
]
if
"
card_id
"
in
request
.
data
:
el
if
"
card_id
"
in
request
.
data
:
# ToDo: Diskussion: Direkt Karte Ändern?
# ToDo: Diskussion: Direkt Karte Ändern?
try
:
try
:
ldap_user
=
LdapUser
.
objects
.
get
(
uid
=
str
(
request
.
data
[
'
uid
'
]))
ldap_user
=
LdapUser
.
objects
.
get
(
uid
=
str
(
request
.
data
[
'
uid
'
]))
ldap_user
.
card_id
=
request
.
data
[
'
card_id
'
]
if
not
ldap_user
.
card_id
:
ldap_user
.
save
()
ldap_user
.
card_id
=
request
.
data
[
'
card_id
'
]
ldap_user
.
save
()
else
:
return
Response
(
status
=
status
.
HTTP_403_FORBIDDEN
)
except
:
except
:
pass
pass
user
.
card_id
=
request
.
data
[
'
card_id
'
]
user
.
card_id
=
request
.
data
[
'
card_id
'
]
...
@@ -92,7 +95,6 @@ def user_list(request, user_id = 0):
...
@@ -92,7 +95,6 @@ def user_list(request, user_id = 0):
def
sync_users
():
def
sync_users
():
for
user
in
LdapUser
.
objects
.
all
():
for
user
in
LdapUser
.
objects
.
all
():
print
(
user
)
try
:
try
:
u
=
UserCredit
.
objects
.
get
(
uid
=
user
.
uid
)
u
=
UserCredit
.
objects
.
get
(
uid
=
user
.
uid
)
if
user
.
card_id
:
if
user
.
card_id
:
...
...
This diff is collapsed.
Click to expand it.
www/web/warpzone/settings.py
+
24
−
2
View file @
a577a226
...
@@ -15,6 +15,13 @@ config.read('/etc/warpinfra/config.ini')
...
@@ -15,6 +15,13 @@ config.read('/etc/warpinfra/config.ini')
# COMMON
# COMMON
APPS
=
[
app
.
strip
()
for
app
in
config
.
get
(
'
common
'
,
'
APPS
'
).
split
(
"
,
"
)]
APPS
=
[
app
.
strip
()
for
app
in
config
.
get
(
'
common
'
,
'
APPS
'
).
split
(
"
,
"
)]
# MYSQL
MYSQL_HOST
=
config
.
get
(
'
mysql
'
,
'
MYSQL_HOST
'
)
MYSQL_PORT
=
config
.
get
(
'
mysql
'
,
'
MYSQL_PORT
'
)
MYSQL_USER
=
config
.
get
(
'
mysql
'
,
'
MYSQL_USER
'
)
MYSQL_PASS
=
config
.
get
(
'
mysql
'
,
'
MYSQL_PASS
'
)
MYSQL_NAME
=
config
.
get
(
'
mysql
'
,
'
MYSQL_NAME
'
)
# LDAP
# LDAP
LDAP_HOST
=
"
ldap://
"
+
config
.
get
(
'
ldap
'
,
'
LDAP_HOST
'
)
LDAP_HOST
=
"
ldap://
"
+
config
.
get
(
'
ldap
'
,
'
LDAP_HOST
'
)
LDAP_BIND_DN
=
config
.
get
(
'
ldap
'
,
'
LDAP_BIND_DN
'
)
LDAP_BIND_DN
=
config
.
get
(
'
ldap
'
,
'
LDAP_BIND_DN
'
)
...
@@ -67,6 +74,7 @@ INSTALLED_APPS = [
...
@@ -67,6 +74,7 @@ INSTALLED_APPS = [
'
django.contrib.messages
'
,
'
django.contrib.messages
'
,
'
django.contrib.staticfiles
'
,
'
django.contrib.staticfiles
'
,
'
django.contrib.humanize
'
,
'
django.contrib.humanize
'
,
'
django_mysql
'
,
'
bootstrapform
'
,
'
bootstrapform
'
,
'
bootstrap3_datetime
'
,
'
bootstrap3_datetime
'
,
'
rest_framework
'
,
'
rest_framework
'
,
...
@@ -118,10 +126,24 @@ LOCALE_PATHS = (
...
@@ -118,10 +126,24 @@ LOCALE_PATHS = (
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES
=
{
DATABASES
=
{
'
default
'
:
{
'
default
'
:
{
'
ENGINE
'
:
'
django.db.backends.sqlite3
'
,
'
ENGINE
'
:
'
django.db.backends.mysql
'
,
'
NAME
'
:
'
/opt/database/warpzone.db
'
'
NAME
'
:
MYSQL_NAME
,
'
USER
'
:
MYSQL_USER
,
'
PASSWORD
'
:
MYSQL_PASS
,
'
HOST
'
:
MYSQL_HOST
,
'
PORT
'
:
MYSQL_PORT
,
'
OPTIONS
'
:
{
'
init_command
'
:
"
SET sql_mode=
'
STRICT_TRANS_TABLES
'
, innodb_strict_mode=1
"
,
'
charset
'
:
'
utf8mb4
'
,
},
},
},
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': '/opt/database/warpzone.db'
# },
'
ldap
'
:
{
'
ldap
'
:
{
'
ENGINE
'
:
'
ldapdb.backends.ldap
'
,
'
ENGINE
'
:
'
ldapdb.backends.ldap
'
,
'
NAME
'
:
LDAP_HOST
,
'
NAME
'
:
LDAP_HOST
,
...
...
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