README.md 2.15 KB
Newer Older
Douchin Nicolas's avatar
Douchin Nicolas committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Stock Manager

## Virtual Environment

To create the virtual environment, you need to execute the following command:
```bash
python3 -m venv venv
```

In order to activate your virtual environment, you need to execute the following command:
```bash
source venv/bin/activate
```
In order to execute the other commands, you will need your virtual environment activated

To execute the virtual environment:
```bash
deactivate
```

If you want to install requirements, execute the following command:
```bash
pip install --upgrade --requirement requirements.txt
```

## Setup
First, you need to create the settings file:
```bash
make init_settings
```

This command will create the file conf/settings.py

Delestre Nicolas's avatar
Delestre Nicolas committed
34
35
36
37
If needed : 
```bash
chmod +x manage.py
```
Douchin Nicolas's avatar
Douchin Nicolas committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
You'll need to define your SECRET_KEY in it, you can generate one using this command:
```bash
make secret_key
```
Copy/paste the output of this command in your settings file for the variable SECRET_KEY.

You now need to create a superuser:
```bash
make createsuperuser
```

Read the Migrations part and also the Messages part.

Once you have done the migrations part, you can add initial data to your application:
```bash
make init_data
```

You'll also need to assign group(s) to user(s). Go into the admin (usually it's http://127.0.0.1:8000/admin). If you have use initial data, groups should already be created. You'll just need to add group(s) to user(s) going in users part.

## Migrations
In order to create migrations file, you need to use the following command:
```bash
make makemigrations
```

And to apply those changes, this command:
```bash
make migrate
```

If you need to flush the database, you can use this command:
```bash
make flush
```

## Messages
Django supports i18n, it can automatically generates translations file (*.po) using this command:
```bash
make makemessages locale=your_locale
```

Example:
```bash
make makemessages locale=fr
```

Once you have completed this file, you can compile the messages:
```bash
make compilemessages locale=your_locale
```

Example:
```bash
make compilemessages locale=fr
```

## Run
To run your server, you can use this command:
```bash
make run
```

## Documentation
See the related README in docs